Get started creating PDF file with Node and PDFKit.
Installation
$ npm install pdfkit --save |
PDF Creation
Setup
Import the library and create the pdfKit document
var PDFDocument, doc; |
Insert some text
// Set a title and pass the X and Y coordinates |
Check out the documentation for more options, including fonts, colors, text decorations and more !
Insert an image
doc.image('wally.jpg', 50, 150, {width: 300}); |
Result
Run the script as usual with
$ node index.js |
And open the output.pdf file. You can check my result here. Once again, don’t forget to check out the official documentation for more examples and information.