pdf2docx icon indicating copy to clipboard operation
pdf2docx copied to clipboard

遇到无法处理的图片会导致整个程序崩溃

Open lbboier opened this issue 1 year ago • 7 comments

我处理的一个的pdf文件中在67页: image RuntimeError: pixmap must be grayscale or rgb to write as png,这个图片既不是灰度图片也不是一个rgb。代码和报错如下: image 我希望的是能修改这个错误或者抛出这个异常,从而不会导致这个程序崩溃 image

lbboier avatar May 22 '23 10:05 lbboier

请问您解决了么?

Nancis1130 avatar Jun 05 '23 08:06 Nancis1130

请问您解决了么? 这个问题要么修改pdftodocx库要么在调用时不是直接调用cv.convert(docx_file),而是按照convert的结构展开来写,去catch或者throw这个因为异常。我是按照展开convert来写的,直接修改库还是作者实现比较好,因我我对程序结构没那么了解

lbboier avatar Jun 07 '23 06:06 lbboier

截屏2023-11-17 上午11 47 09 可以先临时异常处理一下

liuyang0711 avatar Nov 17 '23 03:11 liuyang0711

截屏2023-11-17 上午11 47 09 可以先临时异常处理一下

我发现可以用pil_tobytes 但是不确定完不完美 image

heweisheng avatar Dec 04 '23 07:12 heweisheng

niubi,it solve a big questesion

Tangsonghuai avatar Apr 03 '24 07:04 Tangsonghuai

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?

tehwenyi avatar Apr 25 '24 09:04 tehwenyi