A modern layout engine, Word that matches the PDF, and Markdown for AI.
The latest PD4ML releases are the biggest step since version 4. PD4ML 4.2 adds a second layout engine for modern HTML and CSS, and builds Word, Markdown and accessibility features on it. PD4ML 4.1 brought standards compliance control, e-invoices and AES encryption, and the maintenance releases added a PDF toolkit and hundreds of layout fixes.
This page shows all of it at a glance. Each topic links to a page with the details.
Modern HTML and CSS, laid out the way Chrome prints it.
A second layout engine, opt-in with one call: a tolerant HTML5 parser, Flexbox, CSS Grid, multi-column layout and media queries level 4, checked against Chrome's print output. @page rules, identical output on every machine and a DOM API come with it.
Flexbox and CSS Grid
Cards, sidebars, dashboards and invoice layouts use the CSS layout models your front-end team already knows. The v40 engine got better Flexbox too: order, flex-basis: 0%, align-self: stretch and browser-like margins.
Multi-column layout across pages
Newsletter and catalog layouts with CSS columns keep flowing from page to page, with their gaps and column rules.
A tolerant HTML5 parser
Broken or sloppy markup is repaired the way browsers repair it, so real-world HTML from editors, CMSs and e-mail converts without clean-up.

Compact PDF, out of the box.
Measured on the 1,642 PDFs of PD4ML's own test suites (text, tables, forms, SVG, images, PDF/A, ZUGFeRD invoices), the files are 25.9% smaller. Every page renders pixel-identical to the previous output, and every PDF/A file still passes veraPDF.
Lean page content
Operators that change nothing are left out of the page content streams, which leaves 16 to 18% less content to parse and render.
Smaller font subsets
An embedded TrueType font holds only the glyphs the pages show. Fonts are often half of a file, so this is where most of the saving comes from.
CJK fonts as subsets
OpenType fonts with CFF outlines, such as Noto Sans CJK, are embedded as a subset: a PDF with a 15 MB font shrinks from 23 MB to a few hundred KB.
Object streams
Small objects are compressed together and the cross-reference table becomes a compressed stream, so files are smaller and load faster.
Brotli for PDF 2.0
Opt in to Brotli stream compression for PDF 2.0 output, for archives where every byte counts.
Linearized PDF
The PDF optimizer writes "Fast Web View" files, so the first page appears while a large PDF is still downloading.
Say which standard a file must meet.
Compliance by target
Name the PDF standard the output must comply with, and set the PDF version and extension level with one API call.
PDF/A-2b and PDF/A-3b
Archive-grade output in line with the current PDF, PDF/A and PDF/UA specifications, and the basis for e-invoices.
Error policies
RELAXED, NORMAL, PEDANTIC or STRICT: you decide whether problems are ignored, thrown, or treated as errors when they could break PDF/A or PDF/UA conformance.
AES encryption
AES-128 is now the default, AES-256 is available, and it no longer needs commons-logging on the classpath.
Custom XMP metadata
addMetadata() writes properties in your own namespace, for example the W3C TDM Reservation Protocol, which tells AI crawlers whether they may use the document for training. In PDF/A output the namespace is declared in an extension schema.
Correct dates and language
/Lang comes from <html lang>, and the PDF and XMP dates carry the daylight saving offset.
More of the page, drawn as in the browser.
CSS gradients
Linear, radial and conic gradients as backgrounds, drawn as vector shading rather than images.
Color emoji
Emoji are drawn in color from a color font instead of as empty boxes.
SVG upgrades
Blur filters (feGaussianBlur), text along a path (<textPath>), stroke-dasharray, inline SVG without xmlns and decimal viewBoxes.
Multi-column PDF
generateMulticolumn() is back from PD4ML v3, for directories, catalogs and dense reference material.
Images without JAI
renderAsImages() writes PNG and TIFF on any Java version, with no extra libraries.
Tables and pagination
Fixes from converting a large corpus of real documents: rowspan and colspan, collapsed borders, <tfoot>, blank trailing pages and headings that stay with the next block.
Built for production load.
- Faster conversion, tested and tuned under multi-threaded mass load (v4.0.23fx2).
- Real-world robustness: a run over a large corpus of real documents fixed the inputs that failed, hung or ran out of memory (v4.0.24).
- Locale-proof PDFs: under locales such as sv_SE, negative numbers used to be written with a Unicode minus that Acrobat refused (error 110). They are now always ASCII (v4.0.23fx2).
- Safe with untrusted HTML: loading of images, stylesheets and fonts can be limited to the locations you list (v4.2).
Word documents that look like the PDF and stay editable.
With the v42 engine, DOCX and RTF are written from the same layout as the PDF, as native, editable Word objects. PD4ML 4.1.1 rebuilt the DOCX output of the v40 engine too.
Editable Word objects
Positioned content, form controls, SVG and rounded boxes become Word shapes and controls you can still edit, not flattened pictures.
Fonts in the document
With pd4ml.docx.embed.fonts, the document's fonts are embedded, so the file looks the same on a machine that doesn't have them.
Watermarks
"CONFIDENTIAL" or "DRAFT" now reaches DOCX and RTF. With v40 it is Word's own editable watermark; with v42 it is drawn exactly as in the PDF.

Accessible PDF and Word from the HTML you already have.
Richer PDF/UA tagging and, new in 4.2, accessible DOCX and RTF from the same HTML, with the UA edition.
Headings and sections
Headings and sections become the document outline that screen-reader users navigate by.
Lists, links and images
Lists keep their nesting, links are tagged with their targets, and images and SVG carry their alternate text.
Formulas, not artifacts
MathML formulas in tagged output (PDF/UA, PDF/A-a) are tagged as Formula with alternate text instead of being hidden as artifacts.
Document lang="en" title="Quarterly results" ├─ H1 Quarterly results ├─ P Revenue grew 12% compared with Q2. ├─ Table │ ├─ TR │ │ ├─ TH scope=Column Region │ │ └─ TH scope=Column Q3 │ └─ TR │ ├─ TD EMEA │ └─ TD 4.2 M ├─ L │ └─ LI ─ LBody Outlook for Q4 └─ Figure Alt="Revenue by region, bar chart"
- <h1>Style “Heading 1”: navigation pane, table of contents
- <th> rowTable header row, repeated on every page
- <img alt>Alternative text of the picture
- <html lang>Document language: en
- <title>Document title in the file properties
The font's features, set from CSS.
Ligatures and small caps
Standard and discretionary ligatures, and true small capitals from the font rather than shrunken capitals.
Figures for finance
Tabular figures line up the columns of invoices and statements; old-style figures, fractions and ordinals suit running text.
Swashes and stylistic sets
font-feature-settings reaches every feature the font has, for brand typography with alternate letter forms.
Letter forms by language
With lang, the font's forms for a language are used: Serbian Cyrillic, Romanian comma-below letters, or the Japanese, Chinese and Korean forms of the same ideographs.
Kerning and synthesis
font-kerning and font-synthesis behave as in the browser, so no fake bold or italic appears where you don't want it.
Variable web fonts
A variable font named by @font-face rules of several weights is drawn at each of those weights, not only at its default one.


International text, shaped correctly.
Vertical Japanese and Chinese
The fonts' vertical forms and metrics, columns that wrap, mixed scripts in bidi order, text-combine-upright for numbers, sideways text and images in vertical lines.
Arabic, Thai and Lao
Shaped with the font's own layout tables, also with fonts that have no presentation forms; Arabic mixed with English is ordered correctly.
Hindi and Khmer
Devanagari is shaped with the right ligatures, for example in the Mangal font, and Khmer lines break between syllables.
Small CJK PDFs
OpenType CJK fonts such as Noto Sans CJK are embedded as a subset: a few hundred KB instead of 23 MB.
Color emoji
Emoji are drawn in color from a color font, in PDF output from both engines.
No more "?" glyphs
Text no configured font can show falls back to your @font-face fonts, and letters such as Polish ę, ł or ś print without a configured font set.
The same glyphs on every server.
- Only the fonts you choose: v42 uses the configured font set,
@font-facerules and the fonts bundled with PD4ML, never the fonts installed on the host. - Web font weights are honored (300, 500, 800 and so on), not only regular and bold (v4.0.23fx2).
- Fonts used at several sizes are embedded once, which keeps files small (v4.1.0).
- Built-in Helvetica, Times and Courier sit on the browser's baseline (v4.0.24).
Give your LLM what the reader sees.
Markdown built from the same layout as the PDF: visible text in reading order, with structure, and page markers that let answers cite the PDF page.
Only what a reader sees
Text hidden by CSS (display: none, visibility: hidden, clipped overflow) is left out, and CSS-generated text such as list numbers and ::before content is kept.
Page markers for citations
Each page can start with <!-- page N -->, where N is the page of the PDF from the same conversion, so a chunk can be cited by page.
PDF and Markdown together
Store the PDF for people and index the Markdown for machines, from one readHTML() and with matching page numbers.
| Region | Q3 | Change |
|---|---|---|
| EMEA | 4.2 M | +9% |
| Americas | 3.1 M | +15% |
<!-- page 3 -->
## Quarterly results
Revenue grew **12%** compared with Q2.
| Region | Q3 | Change |
|----------|------:|-------:|
| EMEA | 4.2 M | +9% |
| Americas | 3.1 M | +15% |
- Outlook for Q4[^1]

[^1]: Forecast as of 30 September.
<!-- page 3 --> marker.Beyond conversion: sign, merge, optimize and exchange.
Java APIs and command-line tools for existing PDFs, in every edition, plus ZUGFeRD and Factur-X e-invoices in the DMS and UA editions.
Digital signatures
com.pd4ml.pdf.sign: sign with PKCS#12 files, PKCS#11 hardware tokens, HSMs and cloud KMS providers, with RFC 3161 timestamps, DocMDP certification and PAdES-LT/LTV.
Merge with tags
com.pd4ml.pdf.merge: combine page ranges from several PDFs into one document. Accessibility tagging is merged too, so PDF/A and PDF/UA files stay tagged.
Optimize and linearize
com.pd4ml.pdf.optimizer: remove unreferenced objects, deduplicate identical content, collapse incremental updates, and write linearized "Fast Web View" files (v4.2).
Features marked v4.2 are part of the PD4ML v4.2.0 development snapshot: download it from the Downloads page or use 4.2.0-SNAPSHOT from the Maven repository. The other features are in the current releases, PD4ML v4.1.2 and v4.0.24. The release notes and What Is New in PD4ML v4.2.0 list every change.
Try PD4ML 4.2 on your own documents.
Download PD4ML, request a free evaluation license and see the new engine, Word and Markdown output on your templates.
