1

This is my code. I am using pdfkit. So, instead of sending a text I want to send an HTML template with dynamic data. Right now I am using doc.text('my text11111'). Can we replace it with a template?

var PDFDocument = require('pdfkit');

  var doc = new PDFDocument({
        size: 'letter'
    });
    doc.pipe(fs.createWriteStream('will.pdf'));
    doc.text('my text11111')
    doc.end();
Dimitri Podborski
  • 3,714
  • 3
  • 19
  • 31
  • An other post talking about Html in pdfs around node.js and pdfkit subjet. https://stackoverflow.com/questions/23625988/html-table-in-pdfkit-expressjs-nodejs – Orelsanpls Aug 23 '17 at 08:41
  • I created an application as per your question.For one time the data is entering into pdf using template.But the second time data is not appending into pdf...... – Syed Ayesha Bebe Aug 24 '17 at 06:42
  • I have solved that problem @ Syed Ayesha Bebe – Ikshit Mathur Aug 29 '17 at 14:04

1 Answers1

0

To send raw html data I suggest you use pdfkitjs npm module. It is inspired by pdfkit.

It's usage is like this

new PDFKit('html', '<h1>Hello</h1>')

Please see the module here