bpampuch / pdfmake
Client/server side PDF printing in pure JavaScript
0.3.0-beta.18
2025-05-09 08:17 UTC
Requires
None
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- 0.3.0-beta.18
- 0.3.0-beta.17
- 0.3.0-beta.16
- 0.3.0-beta.15
- 0.3.0-beta.14
- 0.3.0-beta.13
- 0.3.0-beta.12
- 0.3.0-beta.11
- 0.3.0-beta.10
- 0.3.0-beta.9
- 0.3.0-beta.8
- 0.3.0-beta.7
- 0.3.0-beta.6
- 0.3.0-beta.5
- 0.3.0-beta.4
- 0.3.0-beta.3
- 0.3.0-beta.2
- 0.3.0-beta.1
- 0.2.x-dev
- 0.2.23
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.18
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.x-dev
- 0.1.72
- 0.1.71
- 0.1.70
- 0.1.69
- 0.1.68
- 0.1.67
- 0.1.66
- 0.1.65
- 0.1.64
- 0.1.63
- 0.1.62
- 0.1.61
- 0.1.60
- 0.1.59
- 0.1.58
- 0.1.57
- 0.1.56
- 0.1.55
- 0.1.54
- 0.1.53
- 0.1.52
- 0.1.51
- 0.1.50
- 0.1.41
- 0.1.40
- 0.1.39
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
This package is not auto-updated.
Last update: 2026-11-16 22:47:06 UTC
README
PDF document generation library for Node.js and browsers, written in pure JavaScript.
Check out the playground and examples.
Features
- line wrapping
- text alignment (left, right, centered, justified)
- numbered and bulleted lists
- tables and columns:
- auto/fixed/star-sized widths
- column spans and row spans
- headers automatically repeated after a page break
- snaking columns (newspaper-style layout where content flows from column to column)
- images, SVG and vector graphics
- QR codes
- convenient styling and style inheritance
- page headers and footers:
- static or dynamic content
- access to current page number and page count
- background layer
- watermarks
- page dimensions and orientations
- margins
- document sections
- custom page breaks
- font embedding
- support for complex, multi-level (nested) structures
- table of contents
- document outlines (bookmarks)
- external links and internal navigation
- file attachments
- encryption, password protection and document permissions
- PDF/A support
- helper methods for opening/printing/downloading the generated PDF
- PDF metadata (e.g. author, subject)
Installation
Install with npm:
npm install pdfmake
Quick start
Node.js
Save the following as example.js:
const pdfmake = require('pdfmake'); const Roboto = require('pdfmake/fonts/Roboto'); pdfmake.addFonts(Roboto); const docDefinition = { content: ['Hello from pdfmake!'] }; pdfmake.createPdf(docDefinition).write('document.pdf').catch(console.error);
Run node example.js to create document.pdf in the current directory.
Browser
Save the following as index.html next to your node_modules directory and open it in a browser.
<!doctype html> <meta charset="utf-8"> <script src="node_modules/pdfmake/build/pdfmake.min.js"></script> <script src="node_modules/pdfmake/build/vfs_fonts.js"></script> <button onclick="pdfMake.createPdf(docDefinition).download('document.pdf').catch(console.error)">Download PDF</button> <script> const docDefinition = { content: ['Hello from pdfmake!'] }; </script>
Documentation
See the documentation for usage and API details.
Documentation improvements are welcome in the documentation repository.
Building from source
git clone https://github.com/bpampuch/pdfmake.git
cd pdfmake
npm install
npm run build
License
MIT
Authors
pdfmake is based on PDFKit.
Thanks to all contributors.