From 7e962d60ad8f4eaf9defa1cc017d61a8ada4dc47 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 28 Sep 2018 22:55:53 +0200 Subject: Add acrobat reader compatibility for szipdf format --- PolyglotFile/polyglotszippdf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'PolyglotFile') diff --git a/PolyglotFile/polyglotszippdf.py b/PolyglotFile/polyglotszippdf.py index 0796946..eadf5d0 100644 --- a/PolyglotFile/polyglotszippdf.py +++ b/PolyglotFile/polyglotszippdf.py @@ -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 -- cgit v1.2.3