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-multicolumncommand line option /multicolumntaglib attribute) produces multi-column PDF output as in PD4ML v3.- Tag library 1.2: new descriptor URIs
https://pd4ml.com/tlds/4.2(javax) and4.2-jk(Jakarta); new<pd4ml:transform>attributes (documentTitle,initialPageNumber,kerning,ligatures,protectPhysicalUnitDimensions,formFont,proxy,basicAuthentication);outputFormatacceptsdocx,pdfuaand 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_COMPRESSEDis 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 propertiestdm:reservationandtdm: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-widthin 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: avoidheadings 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: nowrapin 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>withoutxmlnsis rendered; SVGs Batik cannot process fall back to the built-in renderer; decimalviewBoxvalues;stroke-dasharray;text-anchoron 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
Formulawith alternate text instead of artifacts. /Langfrom<html lang>; custom metadata keeps PDF/A valid; setting onlypd4ml.document.datesets the XMP dates; PDF and XMP dates include the DST offset.merge()handles indirect/Infoand outline objects; encrypted PDFs without/IDare decrypted correctly; v3 API page background/watermark onPD4PageMark; 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\ubefore the character.
