Segmentation fault 11 for addRedactAnnot and apply_redactions #1173
Replies: 17 comments
-
That's a bad one! Happens in MuPDF code - not PyMuPDF. |
Beta Was this translation helpful? Give feedback.
-
Submitted a bug to MuPDF: https://bugs.ghostscript.com/show_bug.cgi?id=703388 for your reference. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, I will pay attention to this. |
Beta Was this translation helpful? Give feedback.
-
Let us keep this open until resolved. |
Beta Was this translation helpful? Give feedback.
-
Update: |
Beta Was this translation helpful? Give feedback.
-
Thank you, how to replace mupdf with the latest version in pymupdf? Or can you solve it by upgrading pymupdf? |
Beta Was this translation helpful? Give feedback.
-
Is that urgent for you? |
Beta Was this translation helpful? Give feedback.
-
Yes, do you know what caused this error? |
Beta Was this translation helpful? Give feedback.
-
This error happens inside MuPDF under rare conditions. It has to with the special way the text is coded, I guess I could give better recommendations if I knew what exactly you are trying to achieve. So maybe, just overlaying text with a white rectangle would be sufficient (i.e. not redacting it). What is your operating system and Python version and bitness? |
Beta Was this translation helpful? Give feedback.
-
The environment: 64-bit windows 10 and python3.7 . |
Beta Was this translation helpful? Give feedback.
-
You mean the source code for the font replacement? Font replacement works in 3 steps:
I also have included a JSON file I produced for the PDF you gave me. Maybe it is sufficient for running only step 3 above. |
Beta Was this translation helpful? Give feedback.
-
Thank you, I have received it. |
Beta Was this translation helpful? Give feedback.
-
I did a hack and simply copied the MuPDF modification into my local copy of MuPDF, then generated PyMuPDF anew ... and it seems to work! |
Beta Was this translation helpful? Give feedback.
-
Did the last wheel resolve your issue? |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, it also solves my problem. Use the tool to generate a blank pdf in advance, and then overlay the original PDF on it, the program will not report an error. |
Beta Was this translation helpful? Give feedback.
-
Notes for others interested in this bug:
|
Beta Was this translation helpful? Give feedback.
-
Hello @JorjMcKie, do you also happen to have the wheel for macOS? It's been happening to me for a while but I can't share sample documents because they contain sensitive information… It would be great if you had it, otherwise I'll have to wait for the next version, as you said. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
import fitz
cur_pdf = fitz.open("C_2010638-2.pdf")
r=fitz.Rect([76.10399627685547, 239.55531311035156, 543.1917114257812, 254.18092346191406])
for cur_page in cur_pdf:
cur_page.addRedactAnnot(r,fill=(1, 1, 1))
cur_page.apply_redactions()
cur_pdf.save("C_2010638-1.pdf",garbage=4, clean=1,deflate=True)
There is an error: Segmentation fault.
C_2010638-2.pdf
Beta Was this translation helpful? Give feedback.
All reactions