Ghostscript PDF/A conversion fails: "unable to convert document" on a signed contract
Fixes Ghostscript PDF/A conversion failing with 'unable to convert document' on a signed contract. Use when archiving a signed contract to PDF/A fails. Key trigger: read Ghostscript's real stderr error, then convert an unsigned working copy and keep the signed original as the record.
TL;DR: "Unable to convert document" is the wrapper's generic message - Ghostscript's real error is on stderr. Re-run it with stderr visible to see the actual failure, and expect it to be the signature: signed PDFs use incremental updates that the PDF/A writer cannot faithfully rewrite. Convert an unsigned working copy instead, and keep the signed original as the legal record.
unable to convert documentRe-run the conversion with stderr unhidden:
gs -dPDFA -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out-a.pdf signed.pdfExpected: stderr shows the real PostScript error (often around incremental updates or permissions).Check whether the file is signed or encrypted:
qpdf --check signed.pdfExpected: signature dictionaries or encryption flags - the usual blockers.Render an unsigned working copy:
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=working-copy.pdf signed.pdfExpected: a visually identical PDF with the signature structures flattened away.Run the PDF/A conversion on the working copy. Expected: conversion succeeds and a validator confirms PDF/A compliance.
- Archive both: the signed original as the legal record, the PDF/A copy as the preservation copy, linked in your metadata.
Use this when
- Ghostscript (or a tool wrapping it) fails PDF/A conversion only on signed contracts
- the error message is generic with no PostScript details
- unsigned contracts convert fine with the same command
Not for this skill when
- Ghostscript is not installed or not found (fix the install first)
- the real stderr error is about missing fonts (embed the fonts instead)
- every PDF fails conversion (check the Ghostscript version and command syntax)
Variant phrasings
ghostscript pdf/a conversion signed pdf fails
ghostscript unable to convert document pdfa
convert signed pdf to pdf/a workaround
Why it happens
Digital signatures live in incremental updates appended to the PDF. The pdfwrite device rebuilds the file from scratch for PDF/A, and it cannot preserve signature structures through that rewrite - so it fails (or the wrapper gives up and prints the generic message). The content is fine; the signature container is what breaks.
Edge cases
- Never present the unsigned PDF/A copy as the signed original - the signature is gone.
- Missing-font errors look similar at first glance; always read stderr before assuming it is the signature.
- PDF/A-1 forbids transparency and layers that A-2 and A-3 allow - pick the right conformance level for the source.
- Some signers lock the file against any processing; the print-to-PDF path through a viewer is the fallback.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst__jyMVAU3XfwXlJgAbkAyoA