Skip to content

Apply redactions at the mark’s current position in a layer - #137

Merged
bobsingor merged 1 commit into
embedpdf/mainfrom
codex/redaction-layer-view
Nov 29, 2026
Merged

bobsingor merged 1 commit into
embedpdf/mainfrom
codex/redaction-layer-view

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

Fix

Applying a redaction could read a mark’s original rectangle from the base document after the mark had moved in a layer. In debug builds, resolving those references could also trip the document-view assertion.

Keep the page’s active view in scope throughout EPDFPage_ApplyRedactions, including mark selection and content removal. Both previously expected layer-mode crashes now pass and have been removed from the exceptions list.

Regression test

Move a redaction mark from KEEP to REMOVE in one layer transaction and apply it in the next. Save a full copy, reopen it, and check that only KEEP can be extracted and that REMOVE is absent from the PDF’s reachable objects, including decoded streams. Run the same scenario for a selected mark and for applying all marks.

Verification on macOS arm64

  • All 1,412 debug unit tests passed.
  • In the redaction and content-rewrite suites, 211 tests passed in each of plain and layer mode. One transaction-only case skipped its plain-document parameter in each run. The observed layer writer counts matched the checked-in expectations.
  • The strict fork-tag check and the C API check passed.
  • The new regression and both former layer-mode crashes passed in a release build.

@bobsingor
bobsingor merged commit 65345f1 into embedpdf/main Nov 29, 2026
1 check passed
bobsingor added a commit that referenced this pull request Nov 29, 2026
…/form-appearance-new-stream

Main brought the inline form font fix (#134), the const read of a
drawing rect (#136) and redactions through the active layer (#137).

Two conflicts, each where both sides added to the same place. The
ledger's own-appearance-generator paragraph keeps both additions. The
list of layer-mode writers keeps both sides' tests, and
EPDFFormEmbedderTest.AFieldWithoutWidgetsGetsNoDrawing, new on main,
leaves 8 objects in a layer where main lists 7: one more for the new
stream of its redraw.
bobsingor added a commit to embedpdf/embed-pdf-viewer that referenced this pull request Nov 30, 2026
The release has the runtime changes merged since 7f399f838:

- A redrawn form field gets a new appearance stream, where a text field,
  a dropdown and a list box were drawn into the one they had
  (embedpdf/runtime#135). An undo puts back the stream the widget named,
  so it brings the drawing back. The undo round trips this branch adds
  failed on the old pin and pass on both engines on this one.
- Asking where an annotation without a stored appearance draws reads its
  dictionary and no longer copies it into the document's changes
  (embedpdf/runtime#136).
- A font the form holds inline is made an object of its own before an
  appearance names it (embedpdf/runtime#134), and a redaction is applied
  at the place its mark has in a layer (embedpdf/runtime#137).
- The upstream sync to 31e80351b (Nov 25 2026, embedpdf/runtime#138).

The bindings generated from the release's headers don't change.
runtime-src moves to the pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant