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

Got AttributeError, when tried to add Signature field #4162

Open
harkishankhuva opened this issue Dec 18, 2024 · 1 comment
Open

Got AttributeError, when tried to add Signature field #4162

harkishankhuva opened this issue Dec 18, 2024 · 1 comment
Labels
fix developed release schedule to be determined

Comments

@harkishankhuva
Copy link

Description of the bug

An error occurred while adding the new signature widget to the PDF Page page.add_widget(new_widget).

How to reproduce the bug

Adding a signature field is enough to reproduce the bug.

for page in pdf:
    for widget in page.widgets():
        x, y = widget.rect.x0, widget.rect.y0
        width, height = widget.rect.width, widget.rect.height
        rect = widget.rect
        page.delete_widget(widget)

        new_widget = fitz.Widget()
        new_widget.rect = fitz.Rect(x, y, x+width, y+height)
        new_widget.field_type = fitz.PDF_WIDGET_TYPE_SIGNATURE
        new_widget.field_name = "FIELD NAME"
        annot = page.add_widget(new_widget)
        print(annot.flags)
        break
    break

Raises:

...
AttributeError: module 'pymupdf.mupdf' has no attribute 'pdf_new_nt'

looks like typo: mupdf.pdf_new_nt(sigflags),

mupdf.pdf_new_nt(sigflags),

After a line change to mupdf.pdf_new_int(sigflags), it's working fine.

PyMuPDF version

1.25.1

Operating system

Linux

Python version

3.11

@JorjMcKie JorjMcKie added the fix developed release schedule to be determined label Dec 18, 2024
@JorjMcKie
Copy link
Collaborator

Thanks for the report - corrected the typo.

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

No branches or pull requests

2 participants