Comparing version 1.0.3 to 1.0.4
@@ -18,2 +18,3 @@ // node-pdf | ||
this.setConvertExtension(options.convertExtension); | ||
this.useGM = options.graphicsMagick || false; | ||
@@ -77,6 +78,7 @@ // TODO: make out dir customizable | ||
var pdfFilePath = this.pdfFilePath; | ||
var outputImagePath = "\""+this.getOutputImagePathForPage(pageNumber)+"\""; | ||
var outputImagePath = this.getOutputImagePathForPage(pageNumber); | ||
var convertOptionsString = this.constructConvertOptions(); | ||
return util.format( | ||
"convert %s'%s[%d]' '%s'", | ||
"%s %s'%s[%d]' '%s'", | ||
this.useGM ? "gm convert" : "convert", | ||
convertOptionsString ? convertOptionsString + " " : "", | ||
@@ -83,0 +85,0 @@ pdfFilePath, pageNumber, outputImagePath |
{ | ||
"name": "pdf-image", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "index.js", | ||
@@ -16,3 +16,9 @@ "repository": { | ||
"chai": "~1.9.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~2.3.4" | ||
}, | ||
"scripts": { | ||
"test": "mocha tests/*" | ||
} | ||
} |
@@ -31,5 +31,11 @@ var assert = require("assert"); | ||
expect(pdfImage.constructConvertCommandForPage(1)) | ||
.equal("convert '/tmp/test.pdf[1]' /tmp/test-1.png"); | ||
.equal("convert '/tmp/test.pdf[1]' '/tmp/test-1.png'"); | ||
}); | ||
it("should use gm when you ask it to", function () { | ||
pdfImage = new PDFImage(pdfPath, {graphicsMagick: true}) | ||
expect(pdfImage.constructConvertCommandForPage(1)) | ||
.equal("gm convert '/tmp/test.pdf[1]' '/tmp/test-1.png'"); | ||
}); | ||
// TODO: Do page updating test | ||
@@ -36,0 +42,0 @@ it("should convert PDF's page to a file with the default extension", function () { |
8617
203
1