Add acrobat reader compatibility for szipdf format

This commit is contained in:
ben
2018-09-28 22:55:53 +02:00
parent 79ddd879c3
commit 7e962d60ad
2 changed files with 16 additions and 5 deletions

View File

@@ -28,8 +28,9 @@ from PdfFileTransformer import Pdf
class PolyglotSZipPdf(PolyglotPdfZip):
def __init__(self, Pdf, Zip):
def __init__(self, Pdf, Zip, acrobat_compatibility):
super().__init__(Pdf, Zip)
self.acrobat_compatibility = acrobat_compatibility
def get_rebuild_zip_first_part_size(self):
@@ -82,7 +83,11 @@ class PolyglotSZipPdf(PolyglotPdfZip):
new_pdf.file_offset = offset
pdf_buffer = new_pdf.get_build_buffer()
j2 = pdf_buffer[k2_stream_offset + size_k2_stream:]
new_zip.add_data_to_file(b'', j2, True)
if self.acrobat_compatibility:
new_zip.add_data_to_file(b'\x00', j2, True)
else:
new_zip.add_data_to_file(b'', j2, True)
return new_zip.buffer