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

Add border arround a paragraph with pdfmake

I'm generating pdf via pdfmake. Let's say i have content of the pdf like this var docDefinition = { content: [ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a pharetra odio.', 'Vestibulum erat mauris, sodales…
r_st
  • 103
  • 1
  • 1
  • 8
5
votes
3 answers

Generating PDF file with Ionic framework

Is there any plugin for Ionic framework to generate a pdf file using html content? Basically I need to create a html with values passed from an Ionic mobile application and some css styles, and then convert it into a pdf file which can be saved…
Sajith Dulanjaya
  • 121
  • 1
  • 1
  • 6
5
votes
4 answers

Image not showing when generating pdf in angularjs using pdfmake

I'm using pdfmake, a nice pdf printing library in javascript to generate pdf in my angularjs SPA. Everything is working fine when I'm using only texts. The pdf is showing correctly with all texts in place. But it isn't working for me when I'm trying…
Shuvro
  • 1,499
  • 4
  • 14
  • 34
4
votes
1 answer

Pass css file into PDFMake styles

I'm currently trying to print a string containing HTML markup to pdf using the HTML-to-pdfmake and pdf make libraries. The HTML contains a lot of classes and ids and I have styling for those in a CSS file. Is there a way to pass that CSS file to the…
Dzsonah
  • 125
  • 1
  • 11
4
votes
1 answer

How can I use pdfmake custom fonts in Angular without using the gulp tool?

The standard method for installing custom font files is via the gulp tool, and that's described here: https://pdfmake.github.io/docs/fonts/custom-fonts-client-side/ But if that fails for you, and for me on Windows it seemed to be a rabbit hole,…
MotoRidingMelon
  • 2,347
  • 2
  • 21
  • 28
4
votes
2 answers

Make sub columns (a group of columns with same header) in pdfmake

I would print a table which has a group of columns with the same cell as header. An example in below: I searched possible solution like this but it is a nested table, different of course from my purpose.
gio
  • 801
  • 3
  • 15
  • 27
4
votes
0 answers

Uncaught invalid image, images dictionary should contain dataURL entries (or local file paths in node.js)

When i do export cloned html to PDF, I'm getting bellow error. Uncaught invalid image, images dictionary should contain dataURL entries (or local file paths in node.js) here is my code: var clonedHTML =…
Himang
  • 108
  • 1
  • 10
4
votes
1 answer

How to Save and Retrieve a pdf file in MongoDB in NodeJS

I have an issue where I have saved a small pdf file (~128KB) that is created in my Node.js server backend using Express to a document in Mongodb. I didn't use the Mongo GridFS because the files will always be under the 16MB limit. The collection has…
Heath
  • 153
  • 2
  • 2
  • 13
4
votes
0 answers

using custom font pdfmake for angular

I am following this documentation of custom fonts of pdfmake. I am not able to understand that how can I follow this example of Angular 4+ because my pdfmake file is in node module and it will be change if i transfer my project or clone into another…
xitas
  • 1,136
  • 3
  • 23
  • 47
4
votes
2 answers

How to use external library on angular-cli? (pdfmake)

Ok, so, im using angular-cli for my test project and since im new to web development world im trying new thinks. This time I couldn't make it work. Well, what I tried? well I kind followed pdfmake readme and into my index.html I placed this two…
Bruno Kieling
  • 53
  • 1
  • 7
4
votes
0 answers

Huge bundle file when adding pdfmake (and vfs fonts)

I use the excellent pdfmake JS library in my project, with webpack 2.2. However it makes the produced bundle much larger (at least + 1 MB ouch). One problem is the big fonts file - I only use the default Roboto font, is there a way to get rid of the…
mguijarr
  • 7,641
  • 6
  • 45
  • 72
4
votes
3 answers

Serving PDF content back to browser via Node Express using pdfMake

I am making use of the pdfmake library for generating PDF documents in my node express application and want these to be sent straight back to the client to trigger the browser to automatically download the file. As a reference point I have been…
mindparse
  • 6,115
  • 27
  • 90
  • 191
4
votes
1 answer

Unrecognized document structure: {"style":"subheader","alignment":"right","_margin":[0,20,0,5]}

I am developing an android app that converts details entered in the app to pdf using pdf-make plugin using cordova ionic lab. I am getting the following error while clicking the create button Unrecognized document structure:…
4
votes
2 answers

pdfmake - remove header margin from pages > 1

I'm using this code for header in my generated pdf, but even though the header is removed for pages after the first page, the top margin is still reserved by docDefinition.pageMargins = [10,120,10,70] Is there a way to remove the top margin on…
steakoverflow
  • 1,206
  • 2
  • 15
  • 24
4
votes
0 answers

Change name of exported pdf in ui-grid

I am using pdfmake.js for exporting ui-grid data as a pdf file. However, I am not able to find any option to change the name of the exported file dynamically. Everytime the file is downloaded with same name but I want to change its name on the basis…
Dheeraj vats
  • 348
  • 5
  • 17