[英]How to import an existing PDF file in node.js
我正在为节点导入例程,到目前为止,我可以使用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)在convertPdf2Img(/ docfire / node_modules / pdf2img /)在gm.stream(/docfire/node_modules/gm/lib/command.js:138:10) 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 / _each处的async / lib / async.js:122:13(/docfire/node_modules/async/lib/async.js:46:13)
我已经尝试在GIT网站上为该模块发布问题,但是似乎很多人都遇到了完全相同的问题,而且似乎没有任何关于任何修复的活动。
我理想地想要的是一种从PDF节点提取文本和图像的方法。
我在运行macOS Sierra v10.12.4,节点版本为7.8.0,pdf2img 0.2.0,gm 1.23.0的iMAC上运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.