【发布时间】:2017-05-06 14:27:37
【问题描述】:
我正在研究节点的导入例程,到目前为止,我可以使用 pdf2json 从 PDF 导入文本节点,这很好用,但不适用于基于图像且不包含文本的 PDF。
所以我下载了 pdf2img,但是这个模块有很多问题,我现在遇到的问题是,运行它后,我创建了很多 0 字节的 png 文件,没有内容和错误消息:
/docfire/node_modules/gm/lib/command.js:228
proc.stdin.once('error', cb);
^
TypeError: Cannot read property 'once' of undefined
at gm._spawn (/docfire/node_modules/gm/lib/command.js:228:15)
at /docfire/node_modules/gm/lib/command.js:140:19
at series (/docfire/node_modules/array-series/index.js:11:36)
at gm._preprocess
(/docfire/node_modules/gm/lib/command.js:177:5) 在 gm.stream (/docfire/node_modules/gm/lib/command.js:138:10) 在 convertPdf2Img (/docfire/node_modules/pdf2img/lib/pdf2img.js:93:6) 在 /docfire/node_modules/pdf2img/lib/pdf2img.js:67:9 在 /docfire/node_modules/async/lib/async.js:246:17 在 /docfire/node_modules/async/lib/async.js:122:13 在 _each (/docfire/node_modules/async/lib/async.js:46:13)
我已尝试在 GIT 网站上发布该模块的问题,但似乎有不少人遇到了完全相同的问题,而且似乎没有任何有关任何修复的活动。
理想情况下,我想要一种从 PDF 中提取文本和图像以用于节点的方法。
我在运行 macOS Sierra v10.12.4 的 iMAC 上运行 使用节点版本 7.8.0,pdf2img 0.2.0,gm 1.23.0
【问题讨论】: