Node.js nodejs pdf到图像转换
我正在使用 但我得到了这个错误Node.js nodejs pdf到图像转换,node.js,pdf,imagemagick,imagemagick-convert,Node.js,Pdf,Imagemagick,Imagemagick Convert,我正在使用 但我得到了这个错误 { message: 'Failed to convert page to image', error: { [Error: Command failed: /bin/sh -c convert 'brochure.pdf[0]' 'brochure-0.png' /bin/sh: 1: convert: not found ] killed: false, code: 127, signal: null,
{ message: 'Failed to convert page to image',
error:
{ [Error: Command failed: /bin/sh -c convert 'brochure.pdf[0]' 'brochure-0.png'
/bin/sh: 1: convert: not found
]
killed: false,
code: 127,
signal: null,
cmd: '/bin/sh -c convert \'brochure.pdf[0]\' \'brochure-0.png\'' },
stdout: '',
stderr: '/bin/sh: 1: convert: not found\n' }
请帮助我如何使用nodejs将pdf转换为图像。您需要下载ImageMagick才能使软件包正常工作。请参阅文档中的安装说明 如果您已经这样做了,那么您的路径配置可能出了问题。请尝试以下命令来解决此问题:
export MAGICK_HOME="opt/ImageMagick"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib
export PATH="$MAGICK_HOME/bin:$PATH"
您必须更改软件包有一个npm软件包可以将PDF文件转换为图像文件:PDF poppler它工作得很好尝试一下
祝您好运我已成功运行此命令。sudo apt get install imagemagick ghostscript popperl utils@karamellw如果运行转换的
,结果是什么?如果需要设置路径,可以通过在终端(asuming mac或unix)中键入来实现:导出MAGICK\u HOME=“opt/imagemagick”&&export path=“$MAGICK\u HOME/bin:$path”&&export DYLD\u LIBRARY\u path=“$MAGICK_HOME/lib”
试试看
export MAGICK_HOME="opt/ImageMagick"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib
export PATH="$MAGICK_HOME/bin:$PATH"