You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added try catch and set default but this is just a temporary fix. Especially the defaults for the mbox are totally wrong when the pdf is horizontal oriented.
The company was so kind and generated a sharable pdf which contains the problem.
minimal example:
fromioimportBytesIOfrompdfrwimportPageMergefrompdfrwimportPdfReaderin_file=open("Warenbewegungsschein_Test.pdf", "rb") # opening for [r]eading as [b]inarydata=in_file.read()
raw_pdf=BytesIO(data)
raw_pdf.seek(0)
srcpage=PdfReader(raw_pdf).pagessrcpage=PageMerge() +srcpage[0]
(line numbers may be not correct because of debugging)
python simple_test.py
Traceback (most recent call last):
File "/home/manuel/dls-pdf-parser/pdf_merger/simple_test.py", line 17, in <module>
srcpage = PageMerge() + srcpage[0]
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/pagemerge.py", line 169, in __add__
self.add(item)
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/pagemerge.py", line 176, in add
obj = RectXObj(obj)
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/pagemerge.py", line 56, in __init__
base = pagexobj(page, viewinfo)
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/buildxobj.py", line 300, in pagexobj
rotate = inheritable.Rotate
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/objects/pdfdict.py", line 19, in __getattr__
return self[PdfName(name)]
File "/home/manuel/dls-pdf-parser/venv/lib/python3.10/site-packages/pdfrw/objects/pdfdict.py", line 25, in __getitem__
value = mydict[name]
TypeError: string indices must be integers
Hello,
we found 2 bugs in the library.
This line crashes when there is no
/Rotation
information in the pdf.pdfrw/pdfrw/buildxobj.py
Line 294 in a9d498d
And also this line crashes:
pdfrw/pdfrw/buildxobj.py
Line 295 in a9d498d
I added try catch and set default but this is just a temporary fix. Especially the defaults for the mbox are totally wrong when the pdf is horizontal oriented.
The company was so kind and generated a sharable pdf which contains the problem.
minimal example:
(line numbers may be not correct because of debugging)
Warenbewegungsschein_Test.pdf
The text was updated successfully, but these errors were encountered: