WHAT'S NEW · PD4ML 4.1 AND 4.2

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.

v42 engine
Flexbox, Grid, @page
-25.9%
PDF file size
DOCX
from the PDF's layout
Markdown
for LLM and RAG
PAdES-LTV
signing toolkit
01 · THE V42 ENGINE

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.

v4.2v4.1.2

Multi-column layout across pages

Newsletter and catalog layouts with CSS columns keep flowing from page to page, with their gaps and column rules.

v4.2v42 engine

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.

v4.2v42 engine
The pd4ml.com front page converted to PDF with the v42 engine, open in Adobe Acrobat Reader: navigation bar, dark hero section, customer logos and format tiles, laid out as in a browser
The pd4ml.com front page converted with the v42 engine and opened in Adobe Acrobat Reader. Download the PDF.
02 · LEANER FILES

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.

v4.2both engines

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.

v4.2both engines

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.

v4.0.24both engines

Object streams

Small objects are compressed together and the cross-reference table becomes a compressed stream, so files are smaller and load faster.

v4.2both engines

Brotli for PDF 2.0

Opt in to Brotli stream compression for PDF 2.0 output, for archives where every byte counts.

v4.2opt-in

Linearized PDF

The PDF optimizer writes "Fast Web View" files, so the first page appears while a large PDF is still downloading.

v4.2PDF tools
Total size of the 1,642 PDFs of PD4ML’s test suites
PD4ML 4.1
100%
PD4ML 4.2
74.1%  (−25.9%)
A PDF with a 15 MB CJK font (Noto Sans CJK)
before 4.0.24
23 MB
from 4.0.24
a few hundred KB
File sizes measured on PD4ML's own test suites (text, tables, forms, SVG, images, PDF/A, ZUGFeRD), with every page rendering pixel-identical. See Compact PDF output.
STANDARDS AND CONTROL

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.

v4.1.0

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.

v4.1.0DMS · UA

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.

v4.1.0

AES encryption

AES-128 is now the default, AES-256 is available, and it no longer needs commons-logging on the classpath.

v4.1.0v4.1.2

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.

v4.1.2v4.0.24

Correct dates and language

/Lang comes from <html lang>, and the PDF and XMP dates carry the daylight saving offset.

v4.0.24
GRAPHICS AND LAYOUT

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.

v4.2both engines

Color emoji

Emoji are drawn in color from a color font instead of as empty boxes.

v4.2both engines

SVG upgrades

Blur filters (feGaussianBlur), text along a path (<textPath>), stroke-dasharray, inline SVG without xmlns and decimal viewBoxes.

v4.2v4.1.0v4.0.24

Multi-column PDF

generateMulticolumn() is back from PD4ML v3, for directories, catalogs and dense reference material.

v4.0.24

Images without JAI

renderAsImages() writes PNG and TIFF on any Java version, with no extra libraries.

v4.0.24PRO · DMS · UA

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.

v4.0.24
PERFORMANCE AND ROBUSTNESS

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).
03 · WORD OUTPUT

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.

v4.2v42 engine

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.

v4.2v42 engine

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.

v4.2both engines
The pd4ml.com front page converted to DOCX, open in Microsoft Word: the layout matches the PDF, and the headline, buttons and navigation are editable text
The same conversion written as DOCX and opened in Microsoft Word: the layout matches the PDF, and the text stays editable. Download the DOCX.
04 · ACCESSIBILITY

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.

v4.2v42 engineUA

Lists, links and images

Lists keep their nesting, links are tagged with their targets, and images and SVG carry their alternate text.

v4.2v42 engineUA

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.

v4.0.24UA
PDF/UA: the structure tree
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"
DOCX: what Word and screen readers see
  • <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 same HTML, written as tagged PDF/UA and as an accessible DOCX (UA edition, v42 engine).
05 · FINE TYPOGRAPHY

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.

v4.2v42 engine

Figures for finance

Tabular figures line up the columns of invoices and statements; old-style figures, fractions and ordinals suit running text.

v4.2v42 engine

Swashes and stylistic sets

font-feature-settings reaches every feature the font has, for brand typography with alternate letter forms.

v4.2v42 engine

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.

v4.2v42 engine

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.

v4.2v42 engine

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.

v4.2both engines
A table comparing text without and with CSS font features: old-style and tabular figures, diagonal fractions, ordinals, a slashed zero, superscript and subscript glyphs, a swash, stylistic sets and font-feature-settings
OpenType features from CSS: figures, fractions, ordinals, swashes and stylistic sets, without and with the feature.
Vertical Japanese text in a table cell with vertical punctuation and brackets, wrapping into further columns; below, Latin, Hebrew and Arabic turned as words in vertical lines
Vertical Japanese with its vertical forms, and Latin, Hebrew and Arabic in vertical lines, as Chrome sets them.
EVERY SCRIPT

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.

v4.2v42 engine

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.

v4.0.24v4.1.0

Hindi and Khmer

Devanagari is shaped with the right ligatures, for example in the Mangal font, and Khmer lines break between syllables.

v4.1.0v4.2

Small CJK PDFs

OpenType CJK fonts such as Noto Sans CJK are embedded as a subset: a few hundred KB instead of 23 MB.

v4.0.24both engines

Color emoji

Emoji are drawn in color from a color font, in PDF output from both engines.

v4.2both 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.

v4.1.2v4.2
PREDICTABLE FONTS

The same glyphs on every server.

  • Only the fonts you choose: v42 uses the configured font set, @font-face rules 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).
06 · MARKDOWN FOR AI

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.

v4.2v42 engine

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.

v4.2v42 engine

PDF and Markdown together

Store the PDF for people and index the Markdown for machines, from one readHTML() and with matching page numbers.

v4.2v42 engine
PDF, 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 Q41
1 Forecast as of 30 September.
3
Markdown from the same conversion
<!-- 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]

![Revenue by region](chart.png)

[^1]: Forecast as of 30 September.
One conversion, two outputs: the PDF page for people, the Markdown for the model, tied together by the <!-- page 3 --> marker.
07 · PDF TOOLKIT

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.

v4.0.23fx2All editions

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.

v4.0.23fx2All editions

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).

v4.0.23fx2v4.2
01 · CONVERTHTML to PDFa report or contract, tagged and archive-ready
02 · MERGEAdd a coverpage ranges of other PDFs, accessibility tags kept
03 · OPTIMIZEShrinkdeduplicated content, linearized for Fast Web View
04 · SIGNPAdES-LTVkey on an HSM or token, RFC 3161 timestamp
05 · ARCHIVEReady to keepvalidation data embedded for long-term checks
The whole document workflow in one Java library: every step is also a command-line tool.

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.