Meta/jbig2_to_pdf.py: Write correct page contents stream length

The previoulsy hardcoded `25` worked only if the image had width and
height with three digits each (e.g. 399x400).
This commit is contained in:
Nico Weber 2024-04-01 20:05:11 -07:00 committed by Tim Flynn
parent 2872c37993
commit 05844141bf
Notes: sideshowbarker 2024-07-18 05:37:06 +09:00

View file

@ -115,6 +115,10 @@ def main():
''')
operators = dedent(b'''\
%d 0 0 %d 0 0 cm
/Im Do''' % (width, height))
objs = [dedent(b'''\
1 0 obj
<<
@ -152,13 +156,14 @@ def main():
dedent(b'''\
4 0 obj
<</Length 25>>
<</Length %d>>
stream
%d 0 0 %d 0 0 cm
/Im Do
''' % len(operators)) +
operators +
dedent(b'''
endstream
endobj
''' % (width, height)),
'''),
dedent(b'''\
5 0 obj