Skip to content

v0.51.0 — a PDF Acrobat wrote could not be opened, and now it can

Choose a tag to compare

@KenM76 KenM76 released this 10 Sep 20:11
· 12 commits to main since this release

The headline: a PDF Acrobat wrote could not be opened, and now it can

A blank spacer page with no /Resources — which Acrobat writes, in its own
stamp files, on your own machine — made pdfcer refuse the whole document,
including the pages that were perfect. Every verb that walks the page tree was
affected: render-page, extract-pages, set-page-size, extract-text.

An absent resource dictionary now resolves to the empty dictionary the
standard itself names
for "this page requires no resources" (ISO 32000-1
Table 30), and pdfcer says it did so — page_resources_defaulted=1 on the
render line, a per-page note on extraction. /MediaBox deliberately did not
move: no clause anywhere names a default page size, so any value would be
invented. The line is invention, not strictness.

★ pdfcer's own smallest test fixture had the same shape, so the engine could
not read the minimal file the project ships.

A stamp restyle was eating your stamp's words

Changing a placed stamp's colour silently replaced its custom label with
the stamp name's default — APPROVED FOR CONSTRUCTION became DRAFT.
Measured on a real file, from a control captioned "colour". Fixed, with a
regression test.

If a document was restyled with an earlier build, pdfcer list-annotations
now prints stamp_label= per annotation, which makes a sweep cheap.

Custom stamps: place them, size them, hear about it

  • pdfcer place-stamp puts a stamp collection's artwork on a page as
    vector — a form XObject behind a /Stamp annotation, which is what
    Acrobat writes. Selectable, movable, deletable, and the page's own content
    stream is never touched. --stamp NAME addresses a stamp the way
    stamp-list prints it; --at X,Y places at the artwork's own size,
    --rect fills a box.
  • A placed stamp's label size can be read and changed
    set-text-annot-style --font-size, and list-annotations reports the size
    and where it came from (the author stated it / pdfcer read it off the
    picture / the file contradicts itself).
  • A shrunk or clipped label reports itself, so --stamp-fit shrink and
    clip are usable at last: pdfcer names the size it chose and how many
    characters did not fit.

⚠ A dynamic stamp places its design-time text. Its words come from Acrobat
JavaScript that pdfcer does not run, and the CLI says so when you place one.

Also in this release

  • A /Text or /Stamp annotation that names a standard icon but carries
    no appearance is now drawn from pdfcer's own artwork, as §12.5.6.4 and
    §12.5.6.12 require of a reader.
  • stamp-pack --stamps-from FILE, because a real artwork sheet is 113 pages
    and nobody types 113 --stamp flags.
  • A page-tree failure stops being reported as "every stamp points at
    nothing"
    page=UNKNOWN, and the real cause named.

For anyone building against pdfcer-core

EditSession::place_page_artwork, add_text_annotation_reporting,
stamp_label_parameters, annot::stamp_label_parameters_in, and
TextAnnotStyle::font_size / stamp_fit. Page::resources_defaulted and
Diagnostics::page_resources_defaulted carry the new disclosure. One new
error variant, EditError::SourcePageOutOfRange. Full contract in
docs/core-api/.


Verified: cargo test --workspace 5,309 pass; tools/run-gates.sh green;
every Pass checked against the operator's own Acrobat-authored stamp file
rather than only against fixtures.