pdf2docx
pdf2docx copied to clipboard
遇到无法处理的图片会导致整个程序崩溃
我处理的一个的pdf文件中在67页:
RuntimeError: pixmap must be grayscale or rgb to write as png,这个图片既不是灰度图片也不是一个rgb。代码和报错如下:
我希望的是能修改这个错误或者抛出这个异常,从而不会导致这个程序崩溃
我将有问题的pdf上传在这儿 Applied Survey Data Analysis (Chapman & Hall CRC Statistics in the Social and Behavioral Scie) ( PDFDrive ).pdf
请问您解决了么?
请问您解决了么? 这个问题要么修改pdftodocx库要么在调用时不是直接调用cv.convert(docx_file),而是按照convert的结构展开来写,去catch或者throw这个因为异常。我是按照展开convert来写的,直接修改库还是作者实现比较好,因我我对程序结构没那么了解
可以先临时异常处理一下
可以先临时异常处理一下
我发现可以用pil_tobytes 但是不确定完不完美
niubi,it solve a big questesion
Hi! I've been facing this issue as well and using pil_tobytes
as mentioned by the above commenter has worked for me. Are there any plans to incorporate this change?