Is there any way to subset_fonts before inserting fonts? #3383
-
I can know all the text before I do the page insertion, this will improve the efficiency of subset_fonts, it seems like subset_fonts doesn't support multithreading. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Threading is not supported at all in PyMuPDF! Please use the Creating font subsets is now directly supported by MuPDF. It still is declared as "experimental", so we haven't yet included it officially. pdf = fitz._as_pdf_document(doc) # access underlying PDF-specific level
fitz.mupdf.pdf_subset_fonts2(pdf, list(range(doc.page_count))) |
Beta Was this translation helpful? Give feedback.
-
Can I use this code block in multiple threads?
|
Beta Was this translation helpful? Give feedback.
Threading is not supported at all in PyMuPDF! Please use the
multiprocessing
module of Python when needed.Creating font subsets is now directly supported by MuPDF. It still is declared as "experimental", so we haven't yet included it officially.
But you can use it and we do not know of any issues. It is at least 15 times faster than the current method.
Here is what you can do instead
doc.subset_fonts()
: