pdfkit

84 views
Skip to first unread message

klr...@gmail.com

unread,
May 9, 2014, 6:08:45 AM5/9/14
to nod...@googlegroups.com
Hi, when I do something like this is that blocking? If so how write it correctly? Thanks

get...
          PDFDocument = require('pdfkit');

          doc = new PDFDocument
          doc.registerFont('Rosario-Italic', 'Rosario-Italic.ttf')

          doc.pipe fs.createWriteStream('output.pdf')
          console.log 'AFTER DOCPIPE'

          doc.font('Rosario-Italic')
             .fontSize(25)
             .text('Some text t!', 100, 100)

          doc.end()

Aria Stewart

unread,
May 9, 2014, 2:09:44 PM5/9/14
to nod...@googlegroups.com

On May 9, 2014, at 6:08 AM, klr...@gmail.com wrote:

> Hi, when I do something like this is that blocking? If so how write it correctly? Thanks
>
> get...
> PDFDocument = require('pdfkit');
>
> doc = new PDFDocument
> doc.registerFont('Rosario-Italic', 'Rosario-Italic.ttf')
>
> doc.pipe fs.createWriteStream('output.pdf’)

If I understand you correctly, you want to do something after the PDF exists?

doc.pipe(fs.createWriteStream(‘output.pdf’)).on(‘end’, function () { do stuff here } ).

> console.log 'AFTER DOCPIPE'
>
> doc.font('Rosario-Italic')
> .fontSize(25)
> .text('Some text t!', 100, 100)
>
> doc.end()
>
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/e7377859-5e7c-4788-a91f-cd94298191ec%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

klrumpf

unread,
May 10, 2014, 7:54:46 AM5/10/14
to nod...@googlegroups.com
Exactly, thanks

Reply all
Reply to author
Forward
0 new messages