# Release Notes - OpenPDF 4.0.0 OpenPDF 4.0 requires Java 25. It contains everything in [OpenPDF 3.0.7](3.0.7.md), including the security fixes of that release, and uses the Foreign Function & Memory API to release memory-mapped files as soon as they are closed. OpenPDF 3.0.x for Java 21 is maintained in the [3.0-java21](https://github.com/LibrePDF/OpenPDF/tree/3.0-java21) branch. ## ⚠️ Upgrade Notes * **Java 25 is required (PR #1685).** The artifacts are compiled for Java 25 and do not run on earlier versions. Stay on OpenPDF 3.0.x if you need Java 21. * **Everything in the upgrade notes of [3.0.7](3.0.7.md) applies**, in particular the stricter signature verification, the changes to HTML to PDF conversion, and the file offsets that are now `long`. * **Memory-mapped files are released on close (PR #1686, #1688).** * A `LongMappedByteBuffer` must not be used after it has been closed. Doing so throws an `IllegalStateException`. * The buffer returned by `RandomAccessFileOrArray.getNioByteBuffer()` for a file is valid until the `RandomAccessFileOrArray` is closed. Before, it stayed valid and kept the file mapped until it was garbage collected. Keep the `RandomAccessFileOrArray` open for as long as the buffer is used. * **A file is no longer read into memory when it is opened (PR #1691).** An unreadable part of a file is reported by the read that touches it, not when the file is opened. * **The old renderer is removed from `openpdf-renderer` (PR #1767).** The classes that were deprecated in 3.0.5, `PDFFile`, `PDFPage`, `PDFParser`, `PDFErrorHandler`, `decode.PDFDecoder`, `decrypt.PDFDecrypter` and `decrypt.PDFDecrypterFactory`, are removed together with everything that only worked with them: all of `org.openpdf.renderer` and its subpackages except `org.openpdf.renderer.core`. * Use `org.openpdf.renderer.core.OpenPdfCoreRenderer`. The README of `openpdf-renderer` lists the replacement for each call. * `OpenPdfCoreRenderer` draws patterns, axial and radial shadings, Type 3 fonts and embedded Type 1 fonts (PR #1772). It does not draw mesh shadings, function-based shadings and embedded bare CFF fonts, which the old renderer did. Stay on OpenPDF 3.0.x if you need them. * `org.openpdf.rups.model.PageLoader` is removed from `pdf-swing`, which no longer depends on `openpdf-renderer`. * **The run direction of a `TextField` no longer depends on ICU4J (PR #1783).** It is chosen with `java.text.Bidi`. * Text that is only right to left looks the same as before. Without ICU4J on the class path, a full stop at the end of such a text was placed at the wrong side. It is now placed as it already was with ICU4J. * With ICU4J, mixed text always ran from right to left. It now follows the larger part of the text. * **`LayoutProcessor` is removed (PR #1773).** Use `GlyphLayoutManager`, which you set on the document. * **`ArabicLigaturizer` is no longer public (PR #1773).** Arabic text with a run direction from right to left is shaped as before, and the Arabic options of `ColumnText` and `PdfPCell` keep their values. * **`BarcodeDatamatrix.getWs()` and `setWs(int)` are removed (PR #1773).** Use `getBorder()` and `setBorder(int)`. * **`FactoryProperties.insertStyle(Map)` is removed (PR #1773).** Nothing called it. `insertStyle(Map, ChainedProperties)` stays, and so do `HTMLWorker`, `HtmlWriter`, `HtmlParser` and the other classes in `org.openpdf.text.html`. * **`HtmlWriter` and `HtmlParser` are no longer deprecated (PR #1773, issue #1583).** `HtmlWriter` is the way to write the same `Document` as PDF and as HTML. None of the classes in `org.openpdf.text.html` is deprecated any more. `HTMLWorker` and the other classes in `org.openpdf.text.html.simpleparser` are still deprecated. * **`HtmlWriter` writes an HTML5 document in UTF-8 (PR #1774).** The output starts with `` and declares ``, so browsers show it in standards mode. Text that is passed to `HtmlWriter.add(String)` is written as UTF-8, not as ISO-8859-1. * **`HtmlWriter` escapes more values (PR #1774).** The values of markup attributes, the HTML style class of the document and the values in a `style` attribute are escaped, and a semicolon is left out of a style value. A value that the caller escaped already is now escaped twice. Two hyphens in a row in a comment are written as `- -`, and `