Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc.need_appearances() fails with "AttributeError: module 'pymupdf.mupdf' has no attribute 'PDF_TRUE' " #3859

Closed
ricardogesuatto-tw opened this issue Sep 11, 2024 · 2 comments
Labels
bug fix developed release schedule to be determined Fixed in next release upstream bug bug outside this package

Comments

@ricardogesuatto-tw
Copy link

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

@JorjMcKie
Copy link
Collaborator

Sorry for my wrong previous post.
This bug is confirmed!

@JorjMcKie JorjMcKie added the bug label Sep 12, 2024
@julian-smith-artifex-com julian-smith-artifex-com added the fix developed release schedule to be determined label Sep 17, 2024
@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.24.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix developed release schedule to be determined Fixed in next release upstream bug bug outside this package
Projects
None yet
Development

No branches or pull requests

3 participants