-
Notifications
You must be signed in to change notification settings - Fork 647
Closed
Labels
Description
Describe the bug (mandatory)
Pdf object gets corrupt after trying to call insertPDF on top of an empty PDF and it also throws either 'stack overflow' or 'cannot find object in xref'
>>> import fitz
>>> a = fitz.open('128pages_part0.pdf')
>>> print(a.pageCount)
128
>>> b = fitz.open()
>>> print(a.pageCount)
128
>>> b.insertPDF(a, from_page=43, to_page=120)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\chest3x\AppData\Local\Continuum\anaconda3\envs\mupdf\lib\site-packages\fitz\fitz.py", line 2436, in insertPDF
val = _fitz.Document_insertPDF(self, docsrc, from_page, to_page, start_at, rotate, links)
RuntimeError: cannot find object in xref (1582 0 R)
>>> print(a.pageCount)
0
>>> print(a)
fitz.Document('128pages_part0.pdf')
Sometimes it also leads to this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\chest3x\AppData\Local\Continuum\anaconda3\envs\mupdf\lib\site-packages\fitz\fitz.py", line 2436, in insertPDF
val = _fitz.Document_insertPDF(self, docsrc, from_page, to_page, start_at, rotate, links)
RuntimeError: exception stack overflow!
After updating from 1.14.17 to 1.16.0, it shows this:
mupdf: malformed page tree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\chest3x\AppData\Local\Continuum\anaconda3\envs\mupdf\lib\site-packages\fitz\fitz.py", line 2784, in insertPDF
val = _fitz.Document_insertPDF(self, docsrc, from_page, to_page, start_at, rotate, links)
RuntimeError: malformed page tree
To Reproduce (mandatory)
Reproduced above, sorry I cannot provide the document in question.
Your configuration (mandatory)
3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
win32
PyMuPDF 1.16.0: Python bindings for the MuPDF 1.16.0 library.
Version date: 2019-08-25 01:01:00.
Built for Python 3.6 on win32 (64-bit).