Pymupdf: Disable error printing or print in UTF-8

Created on 14 Nov 2019  Â·  3Comments  Â·  Source: pymupdf/PyMuPDF

Is your feature request related to a problem? Please describe.
In the case PDF file (not document) contain some non UTF-8 character in a /name or any other tag, error printed to stderr contain this non UTF-8 characters.

mupdf: cannot find startxref
mupdf: FT_New_Memory_Face(TSGEBP+��): SFNT font table missing

I would like to use UTF-8 encoding only.

Describe the solution you'd like
Option 1 is that solution exists already, then I would like to know what to do.
Option 2 is to do not print non UTF-8 charatcers or to replace them with placeholders.
Option 3 is the same as option 2, but this behavior may be secified by parameter or config.
Option 4 is to add an option to disable error output at all.

Additional context
An example of file having this issue:
sample.zip

enhancement

Most helpful comment

solved by v1.16.8

All 3 comments

To keep effort low and to avoid additional possible error sources, I will implement (in v1.16.8) your option 4 and provide a function to manipulate a global parameter to suppress MuPDF error messages alltogether. The function looks like this fitz.TOOLS.mupdf_display_errors(opt) and always returns the current setting (which initially is True). Changes only occur if the bool values True or False are used for opt and remain in effect until changed.

Independent from this setting, all messages still are recorded and can be accessed via fitz.TOOLS.mupdf_warnings().

Jorj


Von: Matmaus notifications@github.com
Gesendet: Thursday, November 14, 2019 8:31:25 AM
An: pymupdf/PyMuPDF PyMuPDF@noreply.github.com
Cc: Jorj X. McKie jorj.x.mckie@outlook.de; Assign assign@noreply.github.com
Betreff: [pymupdf/PyMuPDF] Disable error printing or print in UTF-8 (#403)

Is your feature request related to a problem? Please describe.
In the case PDF file (not document) contain some non UTF-8 character in a /name or any other tag, error printed to stderr contain this non UTF-8 characters.

mupdf: cannot find startxref

mupdf: FT_New_Memory_Face(TSGEBP+��): SFNT font table missing

I would like to use UTF-8 encoding only.

Describe the solution you'd like
Option 1 is that solution exists already, then I would like to know what to do.
Option 2 is to do not print non UTF-8 charatcers or to replace them with placeholders.
Option 3 is the same as option 2, but this behavior may be secified by parameter or config.
Option 4 is to add an option to disable error output at all.

Additional context
An example of file having this issue:
sample.ziphttps://github.com/pymupdf/PyMuPDF/files/3846363/sample.zip

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHubhttps://github.com/pymupdf/PyMuPDF/issues/403?email_source=notifications&email_token=AB7IDIQV77C7QQK5A662363QTVAJ3A5CNFSM4JNKZIOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HZJW6UQ, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB7IDITCPL7TV7H3Y2MZA2DQTVAJ3ANCNFSM4JNKZIOA.

Seems good, thank you very much

solved by v1.16.8

Was this page helpful?
0 / 5 - 0 ratings