Skip to content
Discussion options

You must be logged in to vote

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:

  • check doc.is_repaired which is true in those cases
  • check the content of fitz.TOOLS.mupdf_warnings() which contains all errors and warning messages concatenated by "\n".
  • check the number of pages doc.page_count if zero you know you have a severe problem
  • and of course, if you opened from a bytes object, you can check its length yourself ...
  • are you sure you are always actually dealing with a PDF? There is the separate filetype package, which reads / determines …

Replies: 3 comments 11 replies

Comment options

You must be logged in to vote
3 replies
@gosforth
Comment options

@gosforth
Comment options

@JorjMcKie
Comment options

Answer selected by gosforth
Comment options

You must be logged in to vote
8 replies
@JorjMcKie
Comment options

@gosforth
Comment options

@gosforth
Comment options

@JorjMcKie
Comment options

@gosforth
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants