Skip to content

subset_fonts error exit without exception/warning #3470

@ragebear00

Description

@ragebear00

Description of the bug

in the new PyMUPDF 1.24.3, 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.23.26.

How to reproduce the bug

In PyMUPdf 1.23.26
Traceback (most recent call last):
File "C:_a\PDF_Searchable_v1.py", line 346, in pdfSearhable4
doc.subset_fonts()
File "C:\Users\6\AppData\Local\Programs\Python\Python310\lib\site-packages\fitz\utils.py", line 5631, in subset_fonts
width_table, def_width = get_old_widths(font_xref)
File "C:\Users\6\AppData\Local\Programs\Python\Python310\lib\site-packages\fitz\utils.py", line 5350, in get_old_widths
df_xref = int(df[1][1:-1].replace("0 R", ""))
ValueError: invalid literal for int() with base 10: '<</BaseFont/CIDFont+F1/CIDSystemInfo<</Ordering 97 /Registry 98 /Supplement 0>>/CIDToGIDMap/Identity/FontDescriptor<</Ascent 952/CapHeight 631/Descent -268/Flags 6/FontBBox 99 /FontFile2 100 /FontNam

PyMuPDF version

1.24.3

Operating system

Windows

Python version

3.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions