Use of subset_fonts results in loss of part of the page. #3368
-
pdf: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This method is based on an external package, fontTools, which is not error-free. We are in the process to publish our own font sub-setter, which is directly implemented in MuPDF. It is very much faster (about 15 times) and covers a larger range of fonts. import fitz
doc = fitz.open("input.pdf")
pdf = fitz._as_pdf_document(doc) # access underlying PDF document of the general Document
fitz.mupdf.pdf_subset_fonts2(pdf, list(range(doc.page_count))) # create font subsets As you can see, these are just two lines, but the use still is a little clumsy. |
Beta Was this translation helpful? Give feedback.
-
Perhaps I have a suggestion, you can refer to, in the page to add text, whether we can directly use an external font library and not embedded in the pdf, I can choose a majority of our country's operating system will exist in a font to render, so that in that can ensure that the volume of the pdf can also be a normal display. |
Beta Was this translation helpful? Give feedback.
This method is based on an external package, fontTools, which is not error-free.
So we are not in the position to track down the problem.
In addition we are phasing out this method - another reason why we do not pursue errors here.
We are in the process to publish our own font sub-setter, which is directly implemented in MuPDF. It is very much faster (about 15 times) and covers a larger range of fonts.
It is available as a function in
fitz.mupdf
, but is yet experimental and has no elegant wrapping in PyMuPDF's API yet. It will not report anything back, i.e. there is no "verbose" option or similar.Here is how you can use it today. I tried your example and obviously MuPDF's font sub-setter…