Questions tagged [pdfmake]

Client/server side PDF printing in pure JavaScript

Client/server side PDF printing in pure JavaScript

In-browser

Print PDFs directly in the browser or delegate it to your NodeJS backend. Use the same document definition in both cases.

Fully declarative

Forget about manual x, y calculations. Declare document structure and let pdfmake do the rest.

Powerful layout engine

Use paragraphs, columns, lists, tables, canvas, etc... Declare your own styles, use custom fonts, build a DSL and extend the framework.

Features

  • line-wrapping,
  • text-alignments (left, right, centered, justified),
  • numbered and bulleted lists,
  • tables and columns
    • auto/fixed/star-sized widths,
    • col-spans and row-spans,
    • headers automatically repeated in case of a page-break,
  • images and vector graphics,
  • convenient styling and style inheritance,
  • page headers and footers:
    • static or dynamic content,
    • access to current page number and page count,
  • background-layer
  • page dimensions and orientations,
  • margins,
  • custom page breaks,
  • font embedding,
  • support for complex, multi-level (nested) structures,
  • helper methods for opening/printing/downloading the generated PDF.

References

560 questions
10
votes
2 answers

How to create a PDF on Node.js using PDFMake and vfs_fonts?

It looks like this question has been asked quite a few times with older versions of PDFMake, but hasn't been updated with what appears to be the latest directory structure. Plus, copying fonts into a root "fonts" folder isn't great. How in the world…
Will Lovett
  • 1,241
  • 3
  • 18
  • 35
10
votes
5 answers

How do I align an image with pdfmake?

I'm using pdfmake to create a PDF and have successfully used a data URI to embed an image. It is a small image, about 200px across, and I would like to have it right-aligned. Is there any way to push an image to the right side of the PDF?
user3897392
  • 397
  • 2
  • 5
  • 22
9
votes
10 answers

pdfmake - cant find the font files on vfs

I have the following code I am using to test drive PDFmake. I am having an issue with the location of the font files. I see documentation that seem to indicate that after pulling in the vfs_fonts file that I should be able to see them. However this…
user1247395
  • 409
  • 1
  • 9
  • 20
8
votes
1 answer

Print PDF in ionic 3

I am using PDFMake for creating the pdf with my predefined Document definition. In my old ionic 1 project, I am passing the encoded string to print function which works fine. here is the code for old ionic 1 var dd =…
Ionic
  • 193
  • 1
  • 9
8
votes
3 answers

pdfMake - Wide Table Page Break

I am using pdfMake to generate table reports. Some of the reports are very wide and dont fit on a standard page width, even in landscape mode. Currently, pdfMake is cutting off the table content when it overflows past the page margin. I would…
Jeffrey
  • 1,068
  • 2
  • 15
  • 25
8
votes
4 answers

How to dynamically check remaining page height in PDFMake?

Is there a way to dynamically check remaining page height in PDFMake? When dynamically creating pages, I want to be able to check the remaining available page height to compare it to the element height, so that the last on page element (e.g. image…
Peter Babukh
  • 352
  • 5
  • 18
8
votes
4 answers

TypeError: Cannot read property 'Roboto-Regular.ttf' of undefined

Trying to build a PDF using the JS API PdfMake : Then according to this Helloworld , i run : var docDef={…
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
7
votes
2 answers

Using promises with PDFMake on Firebase Cloud Functions

I am using PDFMake (a variant of PDFKit) to generate PDFs on Firebase Cloud Functions using a realtime database trigger. The function gets all relevant data from the database and then passes it to the function that is supposed to generate the…
Gaurav Wadhwani
  • 1,352
  • 2
  • 15
  • 32
7
votes
1 answer

Tables in pdfMake.js and page break, how to delete bottom empty row

Table with empty row on this example you see, when the table breaks it leaves one empty row, that the same, as the first row on the next page. Question, how can I delete this empty row, that it looks better. Thank for help
Woldemar960
  • 71
  • 1
  • 4
7
votes
6 answers

pdfmake - using own fonts not working

I am using pdfmake to create PDF's on the client side. We have a WYSIWYG editor that allows the users to created a pdf. This is then parsed to work with the pdfmake. However, i cannot get normal fonts to work. The plugin uses vfs_fonts.js to create…
Pooshonk
  • 1,284
  • 2
  • 22
  • 49
7
votes
1 answer

How to make a table of contents using pdfmake?

Is it possible to make a table of content (TOC) using pdfmake? The library will generate the PDF for me but I have no idea on which page a certain object will be rendered. Of course this depends on page size, orientation, etc. Some content will flow…
Paul Kok
  • 91
  • 1
  • 5
7
votes
1 answer

PDFmake: pdfmake.createPdf is not a function

After installing pdfmake using npm: npm install pdfmake --save-dev and compiling bundles with webpack I get an error when running: pdfmake = require 'pdfmake' pdfmake.createPdf(doc_definition).download('test.pdf') Saying: pdfmake.createPdf is not…
Berco Beute
  • 1,115
  • 15
  • 30
7
votes
4 answers

How can I remove some columns in pdf export in angular js ui Grid

I am using Angular JS ui Grid http://ui-grid.info/docs/#/tutorial/312_exporting_data_complex My requirement is that I want to show e.g. 5 columns, but when I export PDF, I don't want to export certain columns like username. How can I do that?
user3214546
  • 6,523
  • 13
  • 51
  • 98
6
votes
1 answer

PDFMake - Dynamic pageMargins depending on header's height

I am dynamically creating a PDF with PDFMake. I have a dynamic content (different number of text rows) that is printed on the header and therefore I can't put a fixed value in the pageMargins because if the text is too large it will be truncated. I…
nsayer
  • 799
  • 2
  • 8
  • 21
6
votes
2 answers

How to center align table - PDFMAKE

Can i create one table with center alignment (page) using PDFMAKE? Already defined alignment: "center" in Styles and inside the tag table: {} { table: { width: "auto", body: [ [ …
Emmanuel Oliveira
  • 144
  • 1
  • 2
  • 14
1
2
3
37 38