Created
November 3, 2015 08:15
-
-
Save aregee/2fa24a75907de8dbe2e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get(/(.*\.pdf)\/([0-9]+).png$/i, function (req, res) { | |
var pdfPath = req.params[0]; | |
var pageNumber = req.params[1]; | |
var PDFImage = require("pdf-image").PDFImage; | |
var pdfImage = new PDFImage(pdfPath); | |
pdfImage.convertPage(pageNumber).then(function (imagePath) { | |
res.sendFile(imagePath); | |
}, function (err) { | |
res.send(err, 500); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment