← All projects
Project record1 mention
Originally shared on Hacker News

fynepdf-pdfa

MIT-licensed PDF/A converter that works without Ghostscript: it opens files with qpdf and converts object by object, keeping PDF/A-allowed content byte for byte, removing or rewriting what PDF/A forbids, and adding what it requires (output intent, XMP, field appearances), while preserving bookmarks, links, form fields and tags. It handles fonts including replacing unembedded ones with metric-compatible free fonts, writes the pdfaid label only when all passes are clean, and is available as an npx CLI and a C++17 library.

Last shared
01 / The problem

What it addresses

Ghostscript's pdfwrite loses content such as bookmarks, links, form fields and tags when re-rendering PDFs, some of its PDF/A output carried the label yet failed veraPDF validation, and its AGPL license kept it out of the submitter's desktop app.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. fynepdf-pdfa

    MIT-licensed PDF/A converter that works without Ghostscript: it opens files with qpdf and converts object by object, keeping PDF/A-allowed content byte for byte, removing or rewriting what PDF/A forbids, and adding what it requires (output intent, XMP, field appearances), while preserving bookmarks, links, form fields and tags. It handles fonts including replacing unembedded ones with metric-compatible free fonts, writes the pdfaid label only when all passes are clean, and is available as an npx CLI and a C++17 library.

    Problem: Ghostscript's pdfwrite loses content such as bookmarks, links, form fields and tags when re-rendering PDFs, some of its PDF/A output carried the label yet failed veraPDF validation, and its AGPL license kept it out of the submitter's desktop app.

    Posted by @biaz · Original source ↗

    Story title · @biaz · · Source ↗

    Show HN: Fynepdf-pdfa – PDF/A conversion without Ghostscript (MIT)

    Submitted URL · @biaz · · Source ↗

    https://github.com/fynepdf/fynepdf-pdfa

    Source text · @biaz · · Source ↗

    We used Ghostscript for PDF/A conversion on our servers, and when we started checking its output with veraPDF, some files carried the PDF/A label but failed validation. Its AGPL also kept it out of our desktop app. So we wrote our own converter and open-sourced it.

    Source text · @biaz · · Source ↗

    Ghostscript's pdfwrite interprets the PDF and writes a new one from what it draws, so anything the writer doesn't carry over is lost: bookmarks, links, form fields, tags, sometimes the text mapping.

    Source text · @biaz · · Source ↗

    fynepdf-pdfa opens the file with qpdf and works object by object. What PDF/A allows stays byte for byte. What it forbids is removed or rewritten (JavaScript, LZW, device CMYK under an sRGB intent, invalid layer configs). What it requires is added (output intent, XMP, field appearances).

    Source text · @biaz · · Source ↗

    It parses TrueType, CFF, Type 1 and CID programs, matches every code the pages show to a glyph, writes widths and cmaps where they disagree, and replaces unembedded fonts with metric-compatible free ones (Arimo for Arial, Tinos for Times, Carlito for Calibri, plus CJK) so no line moves.

    Source text · @biaz · · Source ↗

    What it doesn't do: PDF/A-1b, 2b and 3b only, so no "a" or "u" levels and no PDF/A-4, and no OCR.

    Source text · @biaz · · Source ↗

    To try it: npx fynepdf-pdfa in.pdf out.pdf (Linux x64/arm64, Windows x64, macOS). It's also a C++17 library with CMake support.

    Source text · @biaz · · Source ↗

    How we measured: 2,053 files (the veraPDF corpus, the first 1,000 PDFs of the SafeDocs web crawl, and small files built to break one rule each), converted to PDF/A-2b and checked with veraPDF 1.31