0
나는 https://www.npmjs.com/package/pdf-image을 사용하고 있습니다.nodejs pdf - 이미지 변환
var PDFImage = require("pdf-image").PDFImage;
var pdfImage = new PDFImage("brochure.pdf");
pdfImage.convertPage(0).then(function (imagePath) {
// 0-th page (first page) of the slide.pdf is available as slide-0.png
fs.existsSync("slide-0.png") // => true
},function(err){
console.log(err);
});
는하지만 난 nodejs를 사용하여 이미지를 PDF로 변환 할 수있는 방법 제발 도와주세요이 오류
{ 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' }
을 얻고있다.
난 이미 성공적으로이 명령을 실행했다. sudo apt-get install imagemagick 고스트 스크립트 poppler-utils @Karamell –
'which convert'를 실행하면 어떤 결과가 나옵니까? – Karamell
경로를 설정해야하는 경우, 터미널에 입력하여 (asuming mac 또는 unix) : export MAGICK_HOME = "opt/ImageMagick"&& export PATH = "$ MAGICK_HOME/bin : $ PATH"&& export DYLD_LIBRARY_PATH = "$ MAGICK_HOME/lib"' – Karamell