PD4ML v4.1.2 release notes


PD4ML v4.1.2 is out. It inherits all bug fixes and improvements of PD4ML v4.0.24, and on top of them brings the following changes.

Flexbox

  • The order property is supported.
  • flex-basis: 0% is resolved as in browsers, and percentage widths of flex items use the right base.
  • align-self: stretch, row height shrinking and height: 0 on flex items are applied.
  • Margins of flex items, including negative margins next to floats, are laid out as in browsers.

Metadata

  • New method PD4ML.addMetadata(namespaceURI, prefix, key, value): custom XMP metadata properties in a namespace of your own, for example the W3C TDM Reservation Protocol properties tdm:reservation and tdm:policy. In PDF/A output the namespace is declared in a PDF/A extension schema.
  • XMP metadata values containing &, < or > (title, author, keywords, custom properties) no longer get a stray \u before the character.

Other changes

  • AES encryption no longer needs commons-logging on the classpath (it failed with NoClassDefFoundError: org/apache/commons/logging/LogFactory). The MathML plugin (JEuclid) still needs it; this is now documented.
  • Font fallback: a font declared with @font-face under its own name (e.g. “Haradh Variable”) is used for text no other font can display, instead of showing ? glyphs.
  • The published jar keeps the names of public API that callers reference: enum constants of the com.pd4ml.pdf.* packages (e.g. PdfEncryptor.Algorithm.AES_256, SigningOptions.CertificationLevel.NO_CHANGES_ALLOWED) and the nested types of Constants (e.g. Constants.ErrorPolicy).

PD4ML v4.0.24 release notes


PD4ML v4.0.24 is out. It brings multi-column output back from PD4ML v3, image output without JAI, much smaller PDFs with CJK fonts and a long list of layout fixes found by converting a large corpus of real-world documents. All of these changes are also part of PD4ML v4.1.2.

New and improved

  • generateMulticolumn() (and the -multicolumn command line option / multicolumn taglib attribute) produces multi-column PDF output as in PD4ML v3.
  • Tag library 1.2: new descriptor URIs https://pd4ml.com/tlds/4.2 (javax) and 4.2-jk (Jakarta); new <pd4ml:transform> attributes (documentTitle, initialPageNumber, kerning, ligatures, protectPhysicalUnitDimensions, formFont, proxy, basicAuthentication); outputFormat accepts docx, pdfua and the TIFF variants; new <pd4ml:metadata> and <pd4ml:property> tags; <pd4ml:permissions encryption>.
  • Image output no longer needs JAI: renderAsImages() works on any Java version (TIFF needs Java 9+), format names are accepted in any letter case, TIFF_COMPRESSED is PackBits-compressed; Pd4Cmd -outformat png.
  • OpenType fonts with CFF outlines (.otf, e.g. Noto Sans CJK) are embedded as a subset: a PDF with a 15 MB CJK font is a few hundred KB instead of 23 MB.
  • Robustness from a run over a large real-world document corpus: documents that failed with an exception now convert; pathological input no longer hangs or runs out of memory.
  • New method PD4ML.addMetadata(namespaceURI, prefix, key, value): custom XMP metadata properties in a namespace of your own, for example the W3C TDM Reservation Protocol properties tdm:reservation and tdm:policy. In PDF/A output the namespace is declared in a PDF/A extension schema.

Layout

  • Tables: rowspan rows no longer grow to the whole span; colspan cells over fixed-width columns no longer overlap; width: 100% tables inside padded boxes; max-width in cells, fixed-width columns; collapsed borders next to rowspan cells; structural selectors (:nth-child()) on rows wrapped in misplaced elements; quirks-mode tables no longer inherit font and white-space; a table’s height is shared out among its rows as in browsers (no extra height from the border spacing, no empty rows added by a rowspan reaching past the last row), so fixed-height rows line up with background images.
  • Floats, inline-blocks, absolutely positioned boxes and auto-width cells are no longer stretched by percentage-width content (blocks, tables, images, form controls, floats); flex items sized to content likewise.
  • Pagination: no blank trailing page from the body’s bottom margin; textareas taller than a page split between lines; absolutely positioned content taller than a page is paginated; page-break-after: avoid headings move with the next block; a fieldset moves to the next page with its legend; <pd4ml:page.break ifSpaceBelowLessThan> and late <pd4ml:page.footer>/header definitions are honored; headers/footers given as full HTML documents keep their page scope.
  • Text: no line break before a superscript/subscript glued to the preceding word; words continuing across an inline element boundary are not split at the line end; white-space: nowrap in table cells; fractional percentage lengths are not rounded; RTL/LTR spacing in mixed paragraphs.
  • Form controls: browser default sizes and style for text inputs; inputs inside absolutely positioned elements keep their width; non-Latin input values use the useTTF() fallback; buttons of different heights in one line are aligned on the baseline of their text, as in browsers, instead of on their top edges.
  • Small or zero-height blocks are not stretched to a line height; rounded cell backgrounds without seams.

Fonts and text

  • Thai, Lao and Arabic (fonts without presentation forms) are shaped with the font’s layout tables.
  • Built-in Helvetica/Times/Courier text sits on the browser’s baseline.

SVG

  • Inline <svg> without xmlns is rendered; SVGs Batik cannot process fall back to the built-in renderer; decimal viewBox values; stroke-dasharray; text-anchor on text without x.

RTF and DOCX

  • RTF: body background, block padding and shading, list bullets with several blocks, blocks in table cells and headers/footers, paragraphs in cells and list items, empty anchors, styled <hr>, web-font icons as images, zero-width empty cells (Word showed one page).
  • DOCX: list items containing blocks are well-formed and open in Word; no zero-width grid columns.

PDF, PDF/A and PDF/UA

  • MathML formulas in tagged output (PDF/UA, PDF/A-a) are tagged as Formula with alternate text instead of artifacts.
  • /Lang from <html lang>; custom metadata keeps PDF/A valid; setting only pd4ml.document.date sets the XMP dates; PDF and XMP dates include the DST offset.
  • merge() handles indirect /Info and outline objects; encrypted PDFs without /ID are decrypted correctly; v3 API page background/watermark on PD4PageMark; header/footer title alignment is not overridden by document CSS.
  • XMP metadata values containing &, < or > (title, author, keywords, custom properties) no longer get a stray \u before the character.

PD4ML v3.12.0 release notes


PD4ML v3.12.0 is out. This update of the v3 line fixes rendering issues reported by our users, lowers memory use in long-running servers, and makes PD4ML v3 available from the PD4ML Maven repository.

Rendering

  • The CSS ::before (and :before) pseudo-element with a string content value, including CSS hex escapes such as \e8b8, is rendered in PDF, PDF/A and RTF output instead of being ignored.
  • A page background image given as a Windows file path such as D:/dir/img.jpg or D:\dir\img.jpg is no longer silently ignored, and short background values no longer cause an exception.
  • In PDF/A output, transparent areas of images are rendered white instead of black, so transparent logos and watermark images no longer produce black boxes.
  • In RTF output, list items with several blocks keep their bullet on the first line, and an item following an inline list item gets its own bullet.

Resources

  • The system property pd4ml.fake.browser also applies to resources loaded over https, so images from servers that reject Java’s default User-Agent are no longer dropped.

Memory

  • Image and device objects are no longer held back by finalizers, so memory is released sooner in long-running servers.
  • Less memory when writing large PDF documents: compressed streams no longer allocate a buffer of twice their size, and fewer temporary strings are created.

Distribution

  • PD4ML v3 is published to the PD4ML Maven repository: the trial editions and trial tag libraries are available from https://pd4ml.tech/maven2 (groupId org.zefer.pd4ml.v3, artifacts pd4ml-std-trial, pd4ml-pro-trial, pd4ml-dms-trial, pd4ml-taglib-trial, pd4ml-taglib-jakarta-trial; version 3120 for v3.12.0).

PD4ML v4.1.1 release notes


PD4ML v4.1.1 is out. It inherits all improvements and bug fixes of PD4ML v4.0.23fx2, including the new general-purpose PDF manipulation APIs, and on top of them brings a much better DOCX output.

DOCX output

  • Documents with tables in some styles open in Word again.
  • Line spacing and the spacing before and after paragraphs are kept.
  • Borders, backgrounds and other styles of block elements are kept, including sidebars: their background covers the whole block, and their padding is applied.
  • Headings with nested <span> elements stay on one line, and span backgrounds have the right height.
  • <br> is a real line break instead of a soft return, so the line before it is no longer justified.
  • Superscript links stay in place within the line.
  • <dd> elements are no longer turned into a numbered list.
  • Left indents are applied, e.g. for nested table of contents levels. RTF output got the same fix.
  • The page header is shown on the first page.
  • Headers and footers built as tables are rendered as one table, and the footer is shown on the first page.
  • Table header rows repeat on every page.
  • Images that were missing are embedded, and images are sized as in RTF output, so they fit the page width.
  • Documents converted from a URL are much closer to the RTF output.

Other changes

  • Issues found by a static analysis of the source code are fixed.

PD4ML v4.0.23fx2 release notes


PD4ML v4.0.23fx2 is out. This maintenance update of v4.0.23 includes all fixes of v4.0.23fx1, brings the new general-purpose PDF manipulation APIs, speeds up conversion and fixes layout, font and PDF output issues reported by our users.

New PDF manipulation APIs

  • com.pd4ml.pdf.sign: digital signatures with PKCS#12 files, PKCS#11 hardware tokens, HSMs and cloud KMS providers; RFC 3161 timestamps, DocMDP certification and PAdES-LT/LTV.
  • com.pd4ml.pdf.merge: page ranges from two or more PDFs merged into one document, accessibility tagging included, so merged PDF/A and PDF/UA documents stay tagged.
  • com.pd4ml.pdf.optimizer: removes unreferenced objects, deduplicates identical content and collapses incremental updates into one file.
  • com.pd4ml.pdf.xfdf: export and import of annotations and form data as XFDF (ISO 19444-1).
  • com.pd4ml.pdf.cos: the low-level PDF object model, parser and writer behind the packages above, usable directly for your own structural edits.

Performance

  • Conversion is faster, and PD4ML was tested and tuned under multi-threaded mass load.

Layout and pagination

  • Text with <sub>/<sup> elements on the first line after a page break is no longer partly lost.
  • Overriding the page header after a <pd4ml:page.break> no longer truncates the content of the last page that has the old header.
  • A page footer is placed on the right page again (a regression of v4.0.20).
  • Collapsed table borders are drawn correctly in tables with a <tfoot>.
  • The top page margin no longer changes with the license edition.
  • Spaces between words no longer disappear at some HTML widths, e.g. setHtmlWidth(700).
  • Fewer alignment differences in documents moved over from PD4ML v3.

Fonts

  • font-weight values of web fonts are applied, not only 600.
  • Arabic text from TrueType fonts loaded from the application’s resources is embedded instead of showing ? glyphs.
  • Some Chinese characters (e.g. with “Noto Sans SC Thin”) are no longer garbled (a regression of v4.0.23).
  • Text in embedded TrueType fonts is no longer clipped.

PDF output

  • Negative numbers such as a font’s /ItalicAngle are written with an ASCII minus whatever the JVM’s default locale is. Under locales such as sv_SE they were written with the Unicode minus sign, and Adobe Acrobat refused to open the PDF (error 110).

Other changes

  • Issues found by a static analysis of the source code are fixed.

PD4ML v4.0.23fx1 release notes


PD4ML v4.0.23fx1 is out. This maintenance update of v4.0.23 adds the unicode-range CSS property and makes PDF documents with embedded fonts and dotted borders much smaller.

Fonts

  • The unicode-range descriptor of @font-face is supported, so a font is used only for the characters it is declared for.
  • A TrueType font used at several CSS font sizes is embedded once and reused at every size, as in PD4ML v3. Documents with many sizes of the same font, such as certificates, are several times smaller.
  • Text in Calibri and similar fonts can be copied and pasted from the PDF as readable text.

Rendering

  • Dotted borders no longer make the PDF grow.

PD4ML v4.1.0 release notes


PD4ML v4.1.0 is out. It is the first release of the v4.1 line and inherits all bug fixes of PD4ML v4.0.22. On top of them it brings standards compliance control, XML invoices, error policies and AES encryption; the overview is in New in PD4ML v4.1.0.

New features

  • PDF standards compliance: you specify the PDF standard the output must comply with, and the PDF version and extension level can be set with a new API method. See Compliance with PDF standards.
  • PDF/A-2b and PDF/A-3b output, in line with the current PDF, PDF/A and PDF/UA specifications.
  • ZUGFeRD and Factur-X: hybrid PDF invoices with embedded XML invoice data. See ZUGFeRD and Factur-X PDF Invoices generation.
  • Error policies define whether errors are ignored or thrown to the caller: RELAXED (default, ignore errors where possible), NORMAL (throw an exception on errors), PEDANTIC (also treat possible PDF/A and PDF/UA incompatibilities as errors) and STRICT (throw even on warnings, e.g. when a fallback font is needed).
  • AES encryption; AES-128 is the default encryption method.
  • <video> and <audio> elements are supported.
  • SVG text along a path (<textPath>) is rendered.
  • Hindi text, e.g. in the Mangal font, is shaped with the right ligatures.

Layout and rendering

  • Conditional page breaks break the page when the space below is too small, as in PD4ML v3.
  • A page footer at the end of a table no longer overlaps the last table rows.
  • <ol start> is honored.
  • adjustHtmlWidth() is no longer confused by center-aligned elements.
  • Arabic words mixed with English text are rendered correctly.
  • Inline SVG content is converted.
  • An image is no longer repeated and followed by a black area (a regression of v4.0.9).

API and fixes

  • Kerning no longer causes a NullPointerException.
  • Disabling the cache with Constants.PD4ML_CACHE_ENABLE set to false takes effect.
  • Appending a PDF without a password no longer fails with InvalidPasswordException: No password given.
  • A TrueType font used at several sizes is embedded once, not once per size.

Documentation

  • The documentation is updated to PD4ML v4, and the website moved from pd4ml.tech to pd4ml.com.

PD4ML v4.0.22 release notes


PD4ML v4.0.22 is out. It includes all fixes of PD4ML v4.0.21; on top of them this update makes internal links in PDF documents land where they should, fixes RTF headers, footers and lost content, and solves a hang and slow termination in multi-threaded use.

Links and navigation

  • Links to an anchor in the middle of a paragraph, such as back-links from footnotes to the text, scroll to their target.
  • Relative links in a table of contents scroll to their sections in every document, not only in some page sizes and layouts.

Layout

  • Table columns no longer overlap each other (a regression since v4.0.9fx5).
  • A footnote is no longer repeated at the bottom of the table of contents page.

RTF output

  • The page header is shown on the first page, images in header cells are kept, and table borders hidden in the HTML stay hidden in headers and footers.
  • Parts of the content are no longer missing in the output.

Stability

  • PD4ML.readHTML() no longer loops forever now and then when many documents are converted in parallel threads.
  • pd4ml.terminate() stops a conversion within milliseconds again, instead of after about 20 seconds.
  • Small caps text with bold elements, e.g. <span style="font-variant: small-caps"><b>A</b></span>, no longer causes a StackOverflowError.

PD4ML v4.0.21 release notes


PD4ML v4.0.21 is out. It inherits all fixes of PD4ML v4.0.20fx3 and on top of them improves justified text, lists, tables with row spans and RTF output.

Text

  • Justified text (align="justify" or text-align: justify) no longer adds too much space between words: short words that fit are kept on the line (a regression of v4.0.20fx1), and several other justification issues are fixed.
  • Justified Arabic paragraphs are laid out correctly.
  • Content in the Cambria Math font is displayed.

Lists and tables

  • No extra gap between a list label and the list item text.
  • Ordered list labels use the font of their list item.
  • Table row borders are drawn correctly across cells with rowspan.

RTF output

  • A page footer without a scope is shown on the first page too.
  • An image that doesn’t fit in the remaining space no longer covers the footer, and the images that follow it are rendered.

Other changes

  • A <fieldset> with position: absolute no longer causes a NullPointerException.
  • The javax and Jakarta editions are built from a single code base, so both get every fix at the same time.

PD4ML v4.0.20fx3 release notes


PD4ML v4.0.20fx3 is out. This maintenance update of v4.0.20 improves page rotation, headers and footers, DOCX and RTF output, and the rendering of special symbols and Arabic text.

Pages, headers and footers

  • Pages rotated with <pd4ml:page.break pageFormat="rotate"> keep their page header and footer, and the rotation also applies to DOCX output.
  • Small one-page documents with page headers or footers no longer get an extra blank page.
  • <pd4ml:page.break ifSpaceBelowLessThan> inside a list item no longer causes a ClassCastException, and in DOCX output it breaks the page only when the space below is too small.

Text and fonts

  • text-align: justify works for Arabic text.
  • Greek letters and other special symbols from a symbol font registered with useTTF() are rendered instead of blanks.
  • Fonts of nested <span> elements are applied correctly.
  • List bullets follow the alignment of their list items in PDF and DOCX output.
  • A sporadic conversion error on long-running servers is fixed.

DOCX output

  • Line spacing matches the PDF output, and table cells get the right line height.

RTF output

  • Pages are no longer lost when a highlighted quote section with footnote anchors is placed after the first page.
  • Text with font-variant: small-caps no longer gets a doubled first letter.