Closed
Description
Description of the bug
Since fitz_new
has replaced the old fitz
module, attempting to set the /NeedAppearances
property with doc.need_appearances()
results in an AttributeError
. It seems the attributes PDF_TRUE
and PDF_FALSE
are missing from the new module.
I could reproduce this issue with PyMuPDF version 1.24.10. Notice that doc.need_appearances()
used to work with fitz_old
in version 1.24.1 and earlier.
How to reproduce the bug
The issue can be reproduced with this example PDF form:
http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf
When attempting to set doc.need_appearances()
with the snippet below:
import fitz
with fitz.open("OoPdfFormExample.pdf") as doc:
# Needed for displaying the form values when printing faxes
doc.need_appearances(True)
print("This should work")
The following traceback is shown:
Traceback (most recent call last):
File "/Users/my_user/example/aaa.py", line 5, in <module>
doc.need_appearances(True)
File "/Users/my_user/Library/Caches/pypoetry/virtualenvs/example-fxn3BqgU-py3.12/lib/python3.12/site-packages/pymupdf/__init__.py", line 4944, in need_appearances
mupdf.pdf_dict_puts(form, appkey, mupdf.PDF_TRUE)
^^^^^^^^^^^^^^
AttributeError: module 'pymupdf.mupdf' has no attribute 'PDF_TRUE'
The same issue happens with PDF_FALSE
as well.
PyMuPDF version
1.24.10
Operating system
MacOS
Python version
3.12