-
Hi, In my project not correct PDF file can happen - not valid file or simply empty file.
I get error:
How to handle this error? I tried:
Does not work. I get error as above.
Does not work. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
MuPDF always does its best to repair a file. Therefore, things must really go very wrong to get an exception.
|
Beta Was this translation helpful? Give feedback.
-
The sequence of logic is:
|
Beta Was this translation helpful? Give feedback.
-
NuPDF's prominent goal is to make a PDF available if a minimum of content seems usable. You may be able to extract valuable stuff (like images or embedded files) from it - even if the page tree is corrupt or if there are severe other damages. Also remember, that PDF is a text file structure potentially interspersed with binary data. There are no overall integrity indicators like hash codes or whatever. Not a strict integral coherent format like we have it with the ZIP format of XPS, FB2 and others. |
Beta Was this translation helpful? Give feedback.
MuPDF always does its best to repair a file. Therefore, things must really go very wrong to get an exception.
So mostly a doc is indeed created.
You now have a number of options to determine if you find this acceptable for going on:
doc.is_repaired
which is true in those casesfitz.TOOLS.mupdf_warnings()
which contains all errors and warning messages concatenated by"\n"
.doc.page_count
if zero you know you have a severe problemfiletype
package, which reads / determines …