Replies: 2 comments
-
I tried your scripts. When doing this, your scripts delivers file sizes of 165 to 184 KB. Both work flawlessly under Adobe Acrobat as well. |
Beta Was this translation helpful? Give feedback.
-
Ok thanks a lot for clarifying. ^_^ |
Beta Was this translation helpful? Give feedback.
-
Environment:
Windows 10 (16GB): 7GB used
Python 3.10 + pymupdf 1.24.6
Python 3.12 + pymupdf 1.24.6
Python 3.10 + pymupdf 1.24.13
Python 3.12 + pymupdf 1.24.13
Code:
Created 5 blank pages with doc.new_page, inserted 230 paragraphs of chinese/Asian characters using insert_htmlbox().
-Saved with save(): PDF size is 592MB
-Saved with save(garbage=4, deflate=True): PDF size is 1.95MB
Created 5 blank pages with doc.new_page, used font=china-ss + doc.subset_fonts(), inserted 230 paragraphs of text with insert_htmlbox().
-Saved with save(): PDF size is 609MB
-Saved with save(garbage=4, deflate=True): PDF size is 250MB
Results:
-Foxit can open the PDF without issues.
-Adobe Acrobat 2024 crashes on both 609MB and 250KB files (though it works fine when each page is saved as a separate PDF or when subset_fonts is used for two pages only).
may i know How to modify the code to prevent Adobe Acrobat from crashing?
A 600MB uncompressed file for just 5 pages of chinese/Asian characters is excessive. For a 200-page PDF, uncompressed, it would require around 24GB of memory—unrealistic.
Additionally, converting the PDF to DOCX and back to PDF reduces the file size to around 350KB, which Adobe Acrobat can handle without issue
test44.zip
Beta Was this translation helpful? Give feedback.
All reactions