Size of PDF file generated is high #2987
-
First of all, thanks for adding I am using
If I add more lines of text using insert_htmlbox(), the file size increases proportionately. Is there any way to keep the pdf file size to low? I am using latest pymupdf with Python 3.10.x and Win11. regards, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
The method dynamically pulls in all required fonts. These may be several. Asian fonts typically are large, but the number of glyphs that you actually use in your text is small.
Please try the following code version: import fitz_new as fitz
import os
out_path = str(os.getcwd()) + '/output/'
pdffilename = out_path + 'sample.pdf'
doc = fitz.open()
page = doc.new_page()
text = "PDF तयार करण्याचा हा माझा पहिला दस्तऐवज प्रकल्प आहे"
rect = fitz.Rect(30, 30, 480, 55)
page.insert_htmlbox(rect, text)
doc.subset_fonts()
doc.ez_save(pdffilename)
doc.close() |
Beta Was this translation helpful? Give feedback.
-
Going to move this to the "Discussions" tab. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. Since column width and row height are not in my control as a user of Now I am using Noted your other comments. |
Beta Was this translation helpful? Give feedback.
The method dynamically pulls in all required fonts. These may be several. Asian fonts typically are large, but the number of glyphs that you actually use in your text is small.
Therefore you should make sure to
Please try the following code version: