Please help me to solve PyPDF2.errors.PdfReaderror: broken xref table[4208]

Hi team,

I have requirement to merge few PDFs. So written the script using PyPDF2 package to the merge files… it was working fine… but some times Im getting “broken xref table” error…

Actually i have two env… if I create exe file(exe file size is high) from first env it’s working fine and ended up with warning “xref table not zero-indexed”

But if i create exe from second env(less size)
Im getting “broken xref table” error. Where in the second env I have installed only required packages to the script inorder to get less size exe file.

Please help me what package I need to install in second env to avoid the error.

Hi Anandhi. Welcome to discuss.python.org.

Will you please post the whole error message? The calling function or module/library file name might be in the message. (Edit your Original Post to add the error.)

Paste the error message between three backticks like this:

```
<error message here>
```

1 Like

Please find the error below when running the exe file produced from first environment

Traceback (most recent call last):
File "PDFMerge.py", line 44, in <module>
File "site-packages\PyPDF2\_merger.py", line 244, in append
File "site-packages\PyPDF2_merger py", line 127, in merge
File "site-packages\PyPDF2\_reader.py", line 267 in init
File "site-packages\PyPDF2\_reader.py", line 1227. In read
PyPDF2.errors.PdfReadError: Broken xref table

Please find the warning message below when running the exe file produced form second environment,

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

Below are libraries that I have used in my code,

from PyPDF2 import PdfFileMerger
import sys
import os
from PIL import Image