censor/Censor
1
37
Fork
You've already forked Censor
3

fix!: support redaction of rotated, cropped and scaled pages, adjust intersection definition #182

Merged
mahlzahn merged 1 commit from mahlzahn/fix_redact_cropped_rotated_scaled_pages into main 2026年04月03日 11:32:45 +02:00 AGit
  1. Unfortunately, upstream library PyMuPDF is quite buggy for rotated or scaled pages. Thus, I
    • reimplemented the determination of rotation or derotation matrix from pages that can be used with scaled pages
    • feed rotated redaction rectangles (with page’s derotation matrix to PyMuPDF’s redaction annotations
    • reimplemented the drawing of the final redaction rectangles
  2. Further, instead of removing links, widgets and annotations if they intersect with redaction rectangles, they will be now removed if they "overlap", means not only touching with their borders. Also, tests for overlapping with points and lines have been added.
  3. Additionally, the safer sanitization function was simplified. Because also PyMuPDF’s function Document.insert_pdf was not reliably copying I reimplemented
    • copying of links to have proper location on rotated/scaled pages
    • copying of widgets, which were sometimes silently lost for I don’t know which reason

Closes #161

1. Unfortunately, upstream library PyMuPDF is quite buggy for rotated or scaled pages. Thus, I - reimplemented the determination of rotation or derotation matrix from pages that can be used with scaled pages - feed rotated redaction rectangles (with page’s derotation matrix to PyMuPDF’s redaction annotations - reimplemented the drawing of the final redaction rectangles 2. Further, instead of removing links, widgets and annotations if they intersect with redaction rectangles, they will be now removed if they "overlap", means not only touching with their borders. Also, tests for overlapping with points and lines have been added. 3. Additionally, the safer sanitization function was simplified. Because also PyMuPDF’s function `Document.insert_pdf` was not reliably copying I reimplemented - copying of links to have proper location on rotated/scaled pages - copying of widgets, which were sometimes silently lost for I don’t know which reason Closes #161
censor-bot approved these changes 2026年04月02日 18:34:33 +02:00
Dismissed

Note

The build job for 69cedfb037abc0c7095ec662884f133d94418b58 finished with status success. Install and run the x86_64 test build with:

curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6371729/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak
flatpak install --user censor-dev.flatpak
flatpak run --user page.codeberg.censor.Censor.Devel
> **Note** > The [build job](https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6371729) for 69cedfb037abc0c7095ec662884f133d94418b58 finished with status **success**. Install and run the x86_64 test build with: > > curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6371729/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak > flatpak install --user censor-dev.flatpak > flatpak run --user page.codeberg.censor.Censor.Devel
mahlzahn added this to the v0.7.0 milestone 2026年04月02日 18:34:53 +02:00
mahlzahn dismissed censor-bot's review 2026年04月03日 11:26:08 +02:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

mahlzahn force-pushed mahlzahn/fix_redact_cropped_rotated_scaled_pages from 69cedfb037
All checks were successful
/ build-start (pull_request_target) Successful in 10s
/ release-prepare (pull_request_target) Has been skipped
/ merge-conditions (pull_request) Successful in 9s
/ checks (pull_request) Successful in 1m46s
to ed8c828a62
All checks were successful
/ merge-conditions (pull_request) Successful in 8s
/ build-start (pull_request_target) Successful in 10s
/ checks (pull_request) Successful in 1m10s
/ release-publish (pull_request_target) Has been skipped
2026年04月03日 11:26:10 +02:00
Compare

Note

The build job for ed8c828a62 finished with status success. Install and run the x86_64 test build with:

curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6374611/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak
flatpak install --user censor-dev.flatpak
flatpak run --user page.codeberg.censor.Censor.Devel
> **Note** > The [build job](https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6374611) for ed8c828a62bd45fa9c46e419849701d868a95dd1 finished with status **success**. Install and run the x86_64 test build with: > > curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6374611/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak > flatpak install --user censor-dev.flatpak > flatpak run --user page.codeberg.censor.Censor.Devel
@ -306,4 +291,0 @@
'samples_artifex/Bug6901014_Arioli-NAG-Warwick.pdf',
'samples_artifex/safedocs/CompactedPDFSyntaxTest.pdf',
],
# Failing for unknown reason
Author
Owner
Copy link

This was a leftover from !169 and !171. These files won’t even be opened anymore.

This was a leftover from !169 and !171. These files won’t even be opened anymore.
mahlzahn marked this conversation as resolved
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
censor/Censor!182
Reference in a new issue
censor/Censor
No description provided.
Delete branch "mahlzahn/fix_redact_cropped_rotated_scaled_pages"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?