gen2brain / go-fitz

Golang wrapper for the MuPDF Fitz library
GNU Affero General Public License v3.0
429 stars 97 forks source link

Error when convert PDF to Image #107

Closed guoquanle closed 1 month ago

guoquanle commented 5 months ago

cleancode.pdf when using doc.Image(pageNumber),this PDF will error, error page is 211.

error info: warning: jbig2dec error: DW value (-75) would make SYMWIDTH (0) negative at symbol 655 (segment 0) warning: jbig2dec warning: failed to decode; treating as end of file (segment 0) error: aborting process from uncaught error!

gen2brain commented 5 months ago

Try with an external library, the bundled library is compiled without CJK.

guoquanle commented 5 months ago

Any external library can be recommend? And I encountered a situation where there was no CJK before, and it gave such an error instead of a direct crash. error: cannot find builtin CJK font

gen2brain commented 5 months ago

You need MuPDF library installed, then use extlib tag, and if needed add static or pkgconfig tags.

blnvdanil commented 1 month ago

Is it possible to catch this error? The fact that the process falls unexpectedly is very frustrating. Also, are there any recomendations how to make sure that my program get a proper (handleable) error without changes in the library? This crashes make me use pymupdf, wich is even more frustrating, than crash, because it is slow, but at least it throws handleable exceptions

gen2brain commented 1 month ago

Now it will return error for broken files when load/run page is started.