-
Notifications
You must be signed in to change notification settings - Fork 87
PDF's over 10 pages are merged back into a single image out of order #45
Comments
I submitted PR #47 to resolve this issue. |
Been at this for days now with this library, the gm library and using gm directly with child.spawn (the only approach I can get working). Is there something blatantly wrong with this? This is a snippet of a larger lab experiment to test various libraries. Notice that this example has // Test fails with the following. Each time I seem to get a randomly different .png though and out of sequence
// error: {
// cmd: "gm convert \"/usr/src/test/temp/live-testing.pdf[8]\" \"/usr/src/test/temp/live-testing-8.png\"",
// code: 1,
// killed: false,
// signal: null
// },
// message: "Failed to convert page to image",
// stderr: "gm convert: Unable to open file (/usr/src/test/temp/live-testing.pdf) [No such file or directory].\n",
// stdout: ""
return new Promise( (resolve, reject) => {
const PDFImage = require("pdf-image").PDFImage
let pdfImage = new PDFImage( pdfPath, { //pdfPath is set global to all tests and the path works for other tests
graphicsMagick: true
})
.convertFile()
.then( imagePath => {
// Never hit because of the error above
console.dir( imagePath );
resolve( imagePath );
})
.catch( err => {
reject( err );
});
}); |
In an effort to help others with the same goal and context: https://gist.github.com/rainabba/d6298b46a01f2558fd06b8f8beea1a39 |
As stated, when converting a PDF with more than 10 pages to a single image, the pages past 10 are appended to the 2nd and 3rd positions of the PDF, for example:
It seems that due to the file naming convention the images are appended in this order which is incorrect:
image0.png
image1.png
image10.png
image11.png
image2.png
image3.png
image4.png
image5.png
image6.png
image7.png
image8.png
image9.png
This is happening at least on macOS, not sure about Ubuntu. Node v8
The text was updated successfully, but these errors were encountered: