-
Notifications
You must be signed in to change notification settings - Fork 648
Closed
Labels
upstream bugbug outside this packagebug outside this package
Description
Description of the bug
Before:
After:
source.pdf
result_annotated.pdf
Notes:
- a similar issue was previously reported in apply_redactions() moving text #2957
- this is being reported on behalf of an Enterprise support customer (I can email details separately if needed).
- We have noticed that some issues like this are resolved when using
Preview.app
to (re-) print the PDF with "scale to fit" turned on.
How to reproduce the bug
import fitz
source_doc = fitz.open('source.pdf')
dst_doc = fitz.open()
dst_doc.insert_pdf(source_doc, 0, 0)
redaction_coords = [(507.3806485, 35.06467372292002, 552.9736259804001, 24.838430185399943),
(212.5271666879999, 137.43544772292012, 258.12014416840003, 127.20920418540004),
(212.527166688, 129.4908031440001, 258.1201441684001, 139.2412260440001)]
page = dst_doc.load_page(0)
for coords in redaction_coords:
redaction = page.add_redact_annot(
coords,
text=" ",
fill=(0.5, 0.5, 0.5), # grey
)
redaction.update()
fitz.utils.apply_redactions(page)
dst_doc.save("result.pdf")
dst_doc.close()
PyMuPDF version
1.23.26
Operating system
MacOS
Python version
3.11
manjuadditive
Metadata
Metadata
Assignees
Labels
upstream bugbug outside this packagebug outside this package