Skip to content

PDFFileMerger : PdfReadWarning: Xref table not zero-indexed. ID numbers for objects will be corrected. [pdf.py:1736] #611

@CheriseCodes

Description

@CheriseCodes

The code

inputs = ["C:/Users/user/Desktop/file1.pdf", "C:/Users/user/Desktop/file2.pdf", "C:/Users/user/Desktop/file3.pdf"]

writer = PdfFileMerger()

for inpfn in inputs:
    f = open(inpfn, 'rb')
    writer.append(PdfFileReader(f))
    f.close()

writer.write("merged.pdf")

Expected Behaviour

Files are merged into a file called merged.pdf

Actual Behaviour

I recieve this error message and files are not merged.

PdfReadWarning: Xref table not zero-indexed. ID numbers for objects will 
be corrected. [pdf.py:1736]
Traceback (most recent call last):
  File "C:\Users\user\Desktop\mergepdfs.py", line 12, in <module>
    writer.append(PdfFileReader(f))
  File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyPDF2\pdf.py", line 1084, in __init__
    self.read(stream)
  File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyPDF2\pdf.py", line 1883, in read
    stream.seek(-11, 1)
OSError: [Errno 22] Invalid argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    PdfMergerThe PdfMerger component is affectedis-bugFrom a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions