Open
Description
Environment
Linux-6.1.0-31-amd64-x86_64-with-glibc2.36
pypdf==5.3.0, crypt_provider=('cryptography', '44.0.0'), PIL=11.1.0
Code + PDF
This is a minimal, complete example that shows the issue:
import fpdf
doc = fpdf.FPDF()
doc.set_compression(0)
font = 'helvetica'
for i in range(2):
doc.add_page()
doc.set_font(font, '', 13.0)
link = None
doc.cell(w=75.0, h=22.0, align='C', text='Hello, world page=%d.' % i, border=0, new_x=fpdf.XPos.LEFT, new_y=fpdf.YPos.NEXT, link=link)
doc.output('pdf.pdf')
import io
from pypdf import PdfReader, PdfWriter
stream = io.BytesIO()
writer = PdfWriter('pdf.pdf', incremental=True)
writer.add_blank_page(72, 72)
writer.write(stream)
with open('pdf-out.pdf', 'wb') as fp:
fp.write(stream.getvalue())
Last object in generated pdf is XRef table but it has no endobj tag:
12 0 obj<<
/Type /XRef
...
/Length 18
stream
....
endstream
endobj <- this element is missing
startxref
1742
%%EOF