t.c
t.c

Reputation: 1257

open pdf after generate pdfkit/node webkit

I am working on a cross-platform App with Nw.js. I am trying to genrate PDF and to get it open but it dont work ! and i have no errors !

    var PDFDocument = require('pdfkit');
    var fs = require('fs'); 
    var appContent = document.getElementsByClassName('response');
    doc = new PDFDocument;
    doc.pipe(fs.createWriteStream('output.pdf'));
    doc.fontSize(15);
    doc.text(appContent[0].innerHTML);
    doc.end();

Do you have any ideas ?
Thanks

Upvotes: 1

Views: 1534

Answers (1)

t.c
t.c

Reputation: 1257

The file is automatically saved in a Temp folder.
just call:

 window.open('output.pdf'); 

And that's it

Upvotes: 1

Related Questions