This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
'add_redact_annot' asking for 'need font file or buffer' for an existing font in PDF #3212
Labels
not a bug
not a bug / user error / unable to reproduce
Description of the bug
Trying to replace one text in a PDF using the following methods:
add_redact_annot
apply_redactions
Text replacement is done but the replaced text is not showing just like the searched text. So, wanted to apply the same font but PyMuPDF is throwing exception saying "need font file or buffer". Font for searched text was 'Verdana' so want to apply the same font for the replaced text.
Here is the log for the operation:
2024-02-29 11:42:34,188 Filename to process: Sample
2024-02-29 11:42:34,194 fonts: [(7, 'ttf', 'TrueType', 'FAAAAH+TimesNewRomanPSMT', 'FAAAAH', 'WinAnsiEncoding'), (11, 'ttf', 'TrueType', 'FAAABB+Verdana', 'FAAABB', 'WinAnsiEncoding'), (16, 'ttf', 'TrueType', 'FAAABG+Verdana-Bold', 'FAAABG', 'WinAnsiEncoding')]
2024-02-29 11:42:34,204 hits: [Rect(170.0, 252.3948974609375, 222.64393615722656, 265.7635498046875)]
2024-02-29 11:42:34,209 search_text: LocalPath
2024-02-29 11:42:34,209 search_text_size: 11.0 search_text_font: Verdana
2024-02-29 11:42:34,213 Exception raised: need font file or buffer
Here is my code:
Trying for long time, need help!
How to reproduce the bug
PyMuPDF version
1.23.25
Operating system
Windows
Python version
3.8
The text was updated successfully, but these errors were encountered: