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

insert_pdf gives TypeError #3471

Closed
wz93672 opened this issue May 13, 2024 · 4 comments
Closed

insert_pdf gives TypeError #3471

wz93672 opened this issue May 13, 2024 · 4 comments

Comments

@wz93672
Copy link

wz93672 commented May 13, 2024

Description of the bug

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\pymupdf\__init__.py", line 4529, in insert_pdf
    self._do_links(docsrc, from_page = from_page, to_page = to_page, start_at = sa)
  File "C:\Program Files\Python311\Lib\site-packages\pymupdf\utils.py", line 1618, in do_links
    annot_text = cre_annot(l, xref_dst, pno_src, ctm)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\pymupdf\utils.py", line 1528, in cre_annot
    annot = txt % (xref_dst[idx], p.x, p.y, lnk["zoom"], rect)
            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for %: 'function' and 'tuple'

How to reproduce the bug

Example file:
https://download.enova.pl/sprzedaz/przewodniki/Procedura_zmiany_opiekuna_systemu_enova365.pdf

>>> with fitz.open() as newdoc:
...     with fitz.open('Procedura_zmiany_opiekuna_systemu_enova365.pdf') as doc:
...             newdoc.insert_pdf(doc)

PyMuPDF version

1.24.3

Operating system

Windows

Python version

3.11

@felixxm
Copy link
Contributor

felixxm commented May 13, 2024

We've run into exactly the same issue:

txt: <function <lambda> at 0x7f63a3e1ade0>
lnk: {
    file: "somepdf",
    from: Rect(473.75, 754.2000122070312, 552.25, 765.25),
    id: "",
    kind: 3,
    xref: 350
}

@felixxm
Copy link
Contributor

felixxm commented May 13, 2024

Regression in bde7550.

@felixxm
Copy link
Contributor

felixxm commented May 14, 2024

Fixed by 2067826.

@wz93672
Copy link
Author

wz93672 commented May 14, 2024

Thanks.
Dzięki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants