-
Notifications
You must be signed in to change notification settings - Fork 693
Open
Labels
upstream bugbug outside this packagebug outside this package
Description
Description of the bug
in the new PyMUPDF 1.26.0, if any error in doc.subset_fonts(), the process will end without any warning or error number. doc.subset_fonts() Error will be raised in PyMUPdf 1.26.0.
How to reproduce the bug
run the code
"""test pymupdf subset_fonts() """
import argparse
import os
import pymupdf
def subset_fonts_test(input_pdf: str, output_pdf: str = None):
"""load PDF,run subset_fonts(),save the result"""
if not os.path.exists(input_pdf):
print(f"the file is not exist: {input_pdf}")
return
if output_pdf is None:
base, ext = os.path.splitext(input_pdf)
output_pdf = f"{base}_subset{ext}"
doc = pymupdf.open(input_pdf)
print(f"load PDF: {input_pdf}, page: {doc.page_count}")
doc.subset_fonts()
print("subset_fonts() finished")
doc.save(output_pdf)
print(f"save to : {output_pdf}")
doc.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="test subset_fonts()")
parser.add_argument("input_pdf", help="input PDF path")
parser.add_argument("-o", "--output", help="output PDF path(optional)")
args = parser.parse_args()
subset_fonts_test(args.input_pdf, args.output)
python test_subset_fonts.py error.pdf
PyMuPDF version
1.26.0
Operating system
Windows
Python version
3.12
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
upstream bugbug outside this packagebug outside this package