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
3
votes
2 answers

Generate pdf reports in Hebrew

I have tried all the react pdf generators to support Hebrew text. I successfully built the whole reporting system with pdfmake, but then I came to realize it doesn’t support Hebrew ( rtl ). I tried to change the fonts by looking on few solutions.…
3
votes
1 answer

Node.js: Adding SVG to a specific page of PDF by pdfmake

I am trying to create PDF content by pdfmake. However, pdfmake do not support adding SVG at v0.1.38. So I use SVG-to-PDFKit to achieve that. Here is my code: var printer = new pdfMakePrinter(fontDescriptors); var doc =…
wdetac
  • 2,712
  • 3
  • 20
  • 42
3
votes
1 answer

pdfMake page break effect when used canvas with type="line"

I would appreciate if someone explain me, which one can be that case, when the canvas declaration with type "line" emit a page break, in the pdf. I unable to figured out what is the cause of it. If I removed all cancas, no page break in the…
L. Kvri
  • 1,456
  • 4
  • 23
  • 41
3
votes
2 answers

How do I center the entire DataTable in the pdf using JQuery pdfHtml5

I'm loving using $('#tableId').DataTable() and the "pdfHtml5" button to generate a PDF. I just can't figure out how to center the information within the generated PDF. A Table with only two columns shows up on the left of the .pdf, but would look…
A554551N
  • 145
  • 1
  • 2
  • 10
3
votes
1 answer

Auto width images in columns using pdfmake.js

I'm trying to create a simple 2-up image layout, so each image is 50% page width in two columns, however the 'auto' or '*' widths don't seem to work with images. Is there any way to achieve this without setting explicit widths for the images? Or…
evu
  • 1,031
  • 2
  • 10
  • 29
3
votes
3 answers

pdfmake: Align table inside the column

No matter what I tried, I'm not able to align table inside of second column. var docDefinition = { content: [ { columns: [ { text: 'Column 1', }, [ { …
Alex G
  • 3,048
  • 10
  • 39
  • 78
3
votes
2 answers

DataTables PDF export (pdfmake): how to prevent breaking rows in page breaks?

I am trying to customize the PDF-Export with DataTables (which uses pdfmake). All my custom styles are working except dontBreakRows, it doesn't seem to make any difference, so table rows contents are being splited in page breaks, instead of keeping…
chimos
  • 664
  • 2
  • 14
  • 34
3
votes
1 answer

magic space between image in pdfMake

When I'm trying to locate images in 2 colomns, I get a space between them. My docDefinition: var dd = { pageSize: 'A4', pageOrientation: 'landscape', pageMargins: [ 0, 0, 0, 0 ], content: [ { columns: [ …
3
votes
1 answer

How to download zip file after creating PDF with pdfMake

I am using pdfMake to create pdf document in my angular project. Meanwhile, I want to create the zip file containing my multiple pdf documents. Are there any possible to do so? Your answers or ideas are appreciated.
chourn solidet
  • 300
  • 5
  • 19
3
votes
2 answers

API Gateway Response Download File using Node, PDFMake, Serverless

I am in the process of migrating my NodeJS project to API Gateway and I cannot figure out how to download a file from Lambda. Here is a snippet of the response code on my local Node project. app.get('/downloadPDF', function (req, res) { …
3
votes
2 answers

How to add image at the end of text line using pdfmake?

I'm using pdfmake. I'm trying to figure out how to add image to the end of text line instead of the new line. For example: var dd = { content: [ 'Test text', {image: 'sampleImage.jpg', width: 24, height: 24} ] } Using this…
3
votes
2 answers

createing PDF with pdfmake just writes the html on pdf

I'm trying to create a pdf from my view created with angular. The problem is that the pdf looks like this: Is it not able to work out the angular markup? var docDefinition = { content: printHtml }; …
Daniel Gustafsson
  • 1,725
  • 7
  • 37
  • 78
3
votes
1 answer

Images & PDFMake

I'm currently using pdfmake to generate project report pdf's given information, and I'm having some trouble getting images to display. I have a function that generates a pdfmake "object" that goes like this: function singleProject(data) { return…
Ed Wu
  • 107
  • 2
  • 2
  • 8
3
votes
1 answer

Use pdfMake with data input in Angular 2 / TypeScript

I'm trying to create PDF from data input in an Angular 2 project. To do this, I integrated pdfMake. Creating static PDF works just fine, but the moment I try to print out some values, it goes wrong. Please have a look at this plunker:…
mgoga
  • 33
  • 1
  • 4
3
votes
1 answer

how to get full web page pdf in pdfmake?

I am working on a web application and I have to convert a HTML page (have multiple tables and datatables) to PDF. I am using pdfmake to convert the content of the page to PDF. This is the script I am using for it