2026-11-24v4.2.0RELEASE v4.2.0 is released and available for download
Bug fixed a page header or footer defined in the first block of a page, inside containers with padding, borders or margins (templates of visual editors, which wrap every block in row and column containers), applies from that page again. Since v4.0.23fx2 such a definition was taken for one further down the page and applied from the next page.
Improvement v42 rendering engine, identified by converting a large corpus of public websites to PDF, DOCX, RTF and Markdown:
  • PDF: pages with nested CSS transforms no longer produce invalid page content
  • web fonts without name records are embedded (the conversion failed with a NullPointerException)
  • repeating gradient patterns (dots, grids of a few pixels) are written compactly: a page of 30 MB is 120 KB now, and no longer runs out of memory
  • RTF: large documents with many pictures no longer run out of memory
  • DOCX/RTF: rasterized regions are stored at 300 dpi at most, photographs as JPEG - about half the file size on image-heavy pages
  • inline SVG with valueless or repeated attributes is drawn; SVG parser messages are no longer printed to the error stream
  • out-of-memory error on web font data that is not WOFF2; a text kerning case that failed the page
Improvement v42 rendering engine:
  • variable web fonts: each font-weight of an @font-face is drawn with an instance of that weight (weight axis, TrueType outlines)
  • gradient text (background-clip: text)
  • SVG: blur filters (feGaussianBlur), clip-path within the image's own area, transparent background of SVG images, arcs of minified paths (they produced an invalid PDF)
  • PDF: images are no longer drawn with the opacity of a translucent shape painted before them
  • @property initial values for var()
  • faster loading of remote resources: connections are reused and resources are loaded by 6 threads by default (asyncResourceLoader(0) restores sequential loading)
Improvement v42 rendering engine performance and memory use:
  • conversion is 35-55% faster and allocates 15-45% less memory on text, table and large documents
  • lower peak memory for documents with many similar elements (large tables, lists)
Improvement v42 DOCX/RTF output follows the PDF layout more closely:
  • CSS multi-column layout (column-count, column-width, column-gap, column-rule, column-fill) as columns side by side, also over page breaks
  • visibility: hidden content keeps its space but is not written
  • boxes with a negative z-index (e.g. a ::before background stripe) placed behind the text
Improvement the v42 rendering engine matches browser layout more closely (page breaks, SVG, CSS, tables, flexbox, DOCX/RTF output):
  • a leading <pd4ml:page.break pageFormat=...> no longer makes a blank first page; its page format applies to page 1
  • named pages without a matching @page rule (as in Word's HTML export) no longer force page breaks
  • SVG: gradients are rendered (also when defined after their use), <mask> content is no longer painted, SVG images take their declared size instead of the viewBox
  • CSS: two-value background-position ("left 27px") is read as x then y; inline backgrounds no longer cover their margins
  • http:/host/... URLs resolve as in browsers; bgcolor applies to body and tables only; invalid attribute selectors are dropped
  • tables: table-layout: fixed is no longer widened by long words; <colgroup> widths are applied; an inherited text-align no longer centers tables
  • display: -webkit-box (2009 flexbox) is laid out as flex
  • flex layout: huge flex factors, image items with a definite height, flexed heights in columns, wrapping containers
  • Word model (DOCX/RTF): the text of in-flow floats, inline-blocks over pages and regions written as pictures is kept
  • ToUnicode of shaped Thai/Lao text maps decomposed characters to the right glyphs
Improvement v42 applies OpenType GSUB/GPOS features itself: ligatures, small caps, figure styles, kerning, font-feature-settings and the other CSS font-variant properties. Vertical text (writing-mode) as in Chrome: vertical glyph forms and metrics, column wrapping, mixed scripts, text-combine-upright. DOCX/RTF carry both as Word's own OpenType settings and vertical text; DOCX can embed fonts (pd4ml.docx.embed.fonts).
Bug fixed A static code analysis of v4.2.0 found no serious issues. The few findings are fixed, and unused code is removed.
  • The CSS :has() selector honors the >, + and ~ combinators (v42 engine): :has(> a) no longer matches deeper descendants, and :has(+ p) and :has(~ p) now match.
  • PD4ML.merge() carries the merged PDF's keywords into the Keywords entry of the result; they were written into its Subject.
  • Minor robustness fixes in DOCX/RTF form fields and list items, MathML resource handling and JPEG orientation detection (v42 engine).
Improvement New method PD4ML.addAllowedResourceLocation(String) limits the locations PD4ML loads stylesheets, images, web fonts and attachments from - a security measure for HTML from untrusted sources (local files, internal services). The same restriction as PD4ML_ALLOWED_RESOURCE_LOCATION param, as a method.
Improvement A generated pd4fonts.properties lists which characters each font file has, so PD4ML no longer loads font files that cannot display the text when it looks for a fallback font. Font lookup is several times faster with a large font directory. Regenerate existing mapping files with java -jar pd4ml.jar -configure.fonts to benefit.
Bug fixed With built-in PDF fonts, text after a character the font cannot write no longer overlaps the "?" drawn for it (v42 engine). The hyphen (U+2010) and non-breaking hyphen (U+2011) now appear as a regular hyphen instead of "?" in PDF output, and instead of an empty box in v40 image output.
Improvement Khmer text wraps (v42 engine): lines break between syllables, as Khmer has no spaces between words.
Bug fixed DOCX and RTF output (v40 engine) wrote font sizes up to 1pt too small (cut to a whole point: 12pt text as 11pt), and protectPhysicalUnitDimensions() made physical sizes about four times too small there instead of keeping them true to size.
Improvement watermarks (setWatermark(), ) in DOCX and RTF output - with the v40 engine as Word's own text watermark (WordArt in the header: editable, page 1 / other pages), with the v42 engine as a picture of the watermark following any page scope.
Improvement with generateForms(true, ...) every form field now carries its own appearance - text, password, textarea, combo and list box values are shown in every viewer, including those that do not regenerate field appearances (print, flattening, PDFBox), and Acrobat no longer asks to save a document that was only read.
Improvement The PDF optimizer can write linearized ("Fast Web View") PDF, so a viewer loading the file over a network shows the first page, and then any other page, before the whole file has arrived: pd4optimizecli --linearize or PdfOptimizer.Options.linearize(true). A PDF 1.5+ document is written linearized with object streams and cross-reference streams. Linearized output cannot be combined with output encryption. Bug fixed: the PDF optimizer (and merger, XFDF import) no longer makes PDF 1.5+ files several times larger - objects are written in compressed object streams with a cross-reference stream, as PD4ML writes its own PDFs; the COS parser reads a compressed object from the object stream its cross-reference entry names. Bug fixed: optimizing or linearizing a PDF/A file keeps it compliant - PDF/A-1 keeps classic cross-reference tables (PD4ML writes it with a 1.7 header), and the file identifier (/ID) is no longer dropped.
Improvement emoji and color fonts (COLR v0/CPAL vector, CBDT/CBLC bitmap - e.g. Twemoji, Noto Color Emoji, Segoe UI Emoji) are drawn in color in PDF and image output, ZWJ sequences, skin tones and flags as single glyphs, and stay selectable/copyable; an emoji font of the font set is used as fallback automatically; the optional com.pd4ml:pd4ml-emoji add-on (Twemoji; Maven repository and distribution zip) enables emoji with no setup.
Improvement CSS gradient backgrounds (linear, radial, conic, repeating; tiled, sized and positioned like images; with transparency) in both layout engines, written to PDF as vector shadings - before, v42 drew a gradient as a black box and v40 ignored it; v42 body/html background images and gradients now also fill every page. In v42 DOCX/RTF output gradients are the word processor's own gradient fills (also on table cells and inline elements), not pictures.
Improvement CSS multi-column layout (v42): a multi-column section longer than the rest of its page now continues page by page, filling the columns of each page before it moves on, instead of being cut across all columns by the page break; column-span: all headings run across the full width between two independently balanced column sets; boxes with break-inside: avoid that do not fit a column move to the next one; column rules are drawn on every page.
Improvement E-mail messages (.eml) and saved web pages (.mht, .mhtml) can be converted with readEML() and readMHT(), and readHTML() recognizes them automatically. Resources load from https:// only, unless addAllowedResourceLocation() sets another list. The attachments of a message are embedded as PDF attachments.
Improvement Smaller and faster-loading PDF output with the same look: small objects are stored compressed in object streams with a compressed cross-reference stream (PDF 1.5 and later; not for PDF/A-1 and encrypted output), pages are organised as a tree of at most 10 entries per node, and page content and dictionaries no longer contain redundant operators or default-value entries. -Dpd4ml.objectStreams=false and -Dpd4ml.optimizeContent=false restore the previous output.
Improvement DOM API (com.pd4ml.dom, v42 engine): getDocument() reads and changes the parsed HTML before the output - CSS selectors, attributes, inner HTML, style sheets; layout() reports page count, each element's boxes per page and computed styles without writing the document.
Improvement With the v42 engine, DOCX and RTF output is written from the same layout as the PDF - same lines, page breaks and spacing - as editable paragraphs and tables; positioned boxes as text boxes, native SVG (DOCX) and native check boxes.
Improvement New layout engine v42 (useHtmlRenderer(LayoutEngine.v42); v40 stays the default): Chrome-verified HTML5/CSS layout with Flexbox, CSS Grid, multi-column, vertical writing modes, @page named pages and margin boxes, richer PDF/UA tagging. Improvement: accessible DOCX and RTF with a PD4ML/UA license (v42 engine): headings as Word heading styles, table header rows, the document language, image alt text and decorative images; without the UA license, Word output carries no alt text, title or accessibility structure.

2026-11-01v4.1.2RELEASE v4.1.2 is released and available for download

2026-11-01v4.0.24RELEASE v4.0.24 is released and available for download

 

27 (cached 2026-11-24 15:23)