Questions tagged [node-pdfkit]

PDFKit is a PDF document generation library for Node that makes creating complex, multi-page, printable documents easy. It is written in pure CoffeeScript, but can be used with regular JavaScript.

PDFKit is a PDF document generation library for Node that makes creating complex, multi-page, printable documents easy. It is written in pure CoffeeScript, but can be used with regular JavaScript.

PDFKit library for and the browser, provides an API implementing a multitude of functionalities, from low level functions to high level abstractions. So enabling the development of complex PDF documents.

It features support for vector graphics, text, font embedding, image embedding, annotations, outlines, security, and is under ongoing development.

More info on the official website https://pdfkit.org/

PDFKit is available under MIT license.

See also:

142 questions
22
votes
2 answers

Generate pdf file using pdfkit and send it to browser in nodejs-expressjs

I am using pdfkit to generate pdf file and i want to send this pdf file to browser. But i am getting message "TypeError: listener must be a function", Also, file is getting generate in my parent directory which i don't want. Can anyone explain…
Sachin
  • 2,321
  • 11
  • 31
  • 49
21
votes
4 answers

HTML table in pdfkit (Expressjs-Nodejs)

I am using pdfkit to generate PDF file and I want to send this PDF file to browser. My following code is working fine and I am getting one pdf with text. Actually following code is sample to generate PDF using pdfkit in Node.js but now I want to…
Sachin
  • 2,321
  • 11
  • 31
  • 49
19
votes
2 answers

Can I mix font weights in the same paragraph when using pdfkit?

I'm trying to find a way to use bold font weights for inline emphasis in pdfkit Unfortunately I cannot find a way to change the font without forcing a line break (bad for inline emphasis...). I was trying something like: pdf.text('Hello ', LEFT,…
m90
  • 11,434
  • 13
  • 62
  • 112
18
votes
4 answers

Upload pdf generated to AWS S3 using nodejs aws sdk

I am using pdfkit to generate a pdf with some custom content and then sending it to an AWS S3 bucket. While if I generate the file as a whole and upload it works perfectly, however, if I want to stream the generated file probably as an octet stream…
Shivendra Soni
  • 672
  • 2
  • 6
  • 19
13
votes
1 answer

PDFKit Node.js measurement unit

What is the measurement unit used in PDFKit (Node.js)? For example we use: doc.text(20, 20, 'Message') What does 20(x) and 20(x) stand for? Is it centimeter, millimeter, inch? Can I change it to any familiar format like cm, mm, or inch? Any ideas?
Hello World
  • 2,673
  • 7
  • 28
  • 60
13
votes
1 answer

How can I get a buffer for a file (image) from CollectionFS

I'm trying to insert an image into a pdf I'm creating server-side with PDFkit. I'm using cfs:dropbox to store my files. Before when I was using cvs:filesystem, it was easy to add the images to my pdf's cause they were right there. Now that…
Jared Martin
  • 653
  • 7
  • 20
12
votes
2 answers

NodeJS and PDFKit: how to make first page to be landscape?

So, I've got a document: var doc = new PDFDocument; The docs tells me that The first page of a PDFKit document is added for you automatically, so there's no need to add it manualy. But how can I meke it to be landscape? This one doc.addPage({ …
k102
  • 7,861
  • 7
  • 49
  • 69
11
votes
4 answers

Is there any trick to rotate text in PDFKit?

I'm using PDFKit.org to generate PDF via JavaScript. The documentation is pretty self-explanatory, but I'm facing an unsolved problem, and I guess some StackOverflow members may have already found a trick to do it. I have to rotate a text at some…
LukyVj
  • 1,495
  • 2
  • 11
  • 18
11
votes
4 answers

Get PDFKit as base64 string

I'm searching a way to get the base64 string representation of a PDFKit document. I cant' find the right way to do it... Something like this would be extremely convenient. var doc = new PDFDocument(); doc.addPage(); doc.outputBase64(function (err,…
rekam
  • 1,061
  • 3
  • 13
  • 31
8
votes
2 answers

Set the default save as name for a an or