Files
pdfcraft/crates
Grzegorz MartensandClaude Opus 5.5 e4d150a92a Merge main into fix/redact-prune-through-forms
Main reworked the redaction cleanups this branch changes: #5969 reads
each inherited form once for all names (`names_content_draws`), #5924
prunes the forms a surviving Type 3 glyph draws and passes the page to
`prune_type3_from_resources`, and #6474 reads a page's annotation
appearances toward one operator total and one byte allowance.

- `interp/prune.rs`: `names_content_draws` keeps main's one read per
  form and takes this branch's three changes to `content_draws`: it
  reads operators one at a time, holding no stream's whole and decoding
  each form only in its turn; it reads forms with `/DecodeParms` given
  by reference; and a `/Resources` that isn't a dictionary is none of
  the form's own. It charges no allowance, as `content_draws` didn't:
  it runs after the pages' walks, over every holder, where no page's
  allowance is left to spend.
- `type3.rs`: `prune_type3_from_resources` takes both the page's
  allowance and main's `page`. The appearances main reads are charged
  to that allowance, which the content and its forms spend too, in
  place of a fresh one of their own, so one page has one allowance.
  Main's `record_used` serves this branch's one-operator-at-a-time read
  of glyph programs, and `scan_stream_object`, which took over
  `scan_xobject`'s read, reads with `/DecodeParms` by reference.
  `prune_font_forms` gives each form's walk the allowance of a page, as
  `prune_retired_properties` does for each content.
- `interp.rs`, `lib.rs`, `sanitize.rs`: both arguments at each call.
- `edit/src/rules.rs`: the refusal of incomplete content stays, with
  main's `text::joined`.
- Tests: both sides' kept, in `edit/src/tests.rs` and
  `redact/src/tests/surviving_references.rs`. A new one,
  `a_page_s_appearances_spend_what_its_content_left_of_the_allowance`,
  pins the shared allowance: 1 MiB of content and an appearance within
  half a MiB of the allowance are refused together, though the
  appearance alone fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-09 11:42:10 +01:00
..
…
…
…
…