Created
December 5, 2015 02:46
-
-
Save anonymous/4a1cf3312a8f09e8afda 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
var PDFDocument = require('pdfkit'); | |
var fs=require('fs'); | |
const getStdin = require('get-stdin'); | |
doc = new PDFDocument({compress:false, sizes:[526,525],autoFirstPage:false}); | |
doc.pipe(fs.createWriteStream('out.pdf')); | |
// add the image and TOGO order text | |
doc.addPage({margin:0}); | |
doc.image('logo3.png'); | |
doc.moveDown(); | |
doc.text("TOGO ORDER", { | |
paragraphGap: 0, | |
indent: 0, | |
align: 'center', | |
columns: 1, | |
width: 135 | |
}); | |
doc.moveDown(); | |
// loop through file and add text | |
getStdin().then(str => { | |
doc.text(str, { | |
paragraphGap: 0, | |
indent: 0, | |
align: 'center', | |
columns: 1, | |
width: 135 | |
}); | |
doc.moveDown(); | |
console.log(str); | |
}); | |
doc.text("DONE", { | |
paragraphGap: 0, | |
indent: 0, | |
align: 'center', | |
columns: 1, | |
width: 135 | |
}); | |
doc.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment