Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

pdfmake

bpampuch2.6mMIT0.2.18TypeScript support: definitely-typed

Client/server side PDF printing in pure JavaScript

pdf, javascript, printing, layout

readme

pdfmake Node.js CI GitHub npm Bower Packagist CDNJS

PDF document generation library for server-side and client-side usage in pure JavaScript.

Check out the playground and examples.

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,
  • table of contents,
  • helper methods for opening/printing/downloading the generated PDF,
  • setting of PDF metadata (e.g. author, subject).

Documentation

Documentation URL: https://pdfmake.github.io/docs/

Building from sources version 0.2.x

using npm:

git clone --branch 0.2 https://github.com/bpampuch/pdfmake.git
cd pdfmake
npm install
npm run build

using yarn:

git clone --branch 0.2 https://github.com/bpampuch/pdfmake.git
cd pdfmake
yarn
yarn run build

License

MIT

Authors

pdfmake is based on a truly amazing library pdfkit (credits to @devongovett).

Thanks to all contributors.

changelog

Changelog

0.2.18 - 2025-01-01

  • Update pdfkit
  • Fixed a potential issue in the minimized library when detecting the orientation of JPEG images

0.2.17 - 2024-12-23

  • Fix big size pdfmake bundle for browser

0.2.16 - 2024-12-15

  • Update pdfkit to 0.15.2
  • Fixed aspect ratio for image with exif orientation tag
  • Fixed font size calculation for watermark if is page orientation is changed

0.2.15 - 2024-11-02

  • Added support PDF/A and PDF/UA (see documentation)
  • Changed Virtual file system (VFS) format for better compatibility with frameworks (backwards compatibility preserved). For compatibility with frameworks, rebuild VFS required!
  • Browser: Added methods for fonts (addFonts, setFonts, clearFonts)
  • Browser: Added methods for table layouts (addTableLayouts, setTableLayouts, clearTableLayouts)
  • Added support link, linkToPage and linkToDestination for SVG
  • Update pdfkit to 0.15.1
  • Fixed bug with how page breaks provoked by cells with rowspan were handled
  • Fixed find where previous cell started with row span and col span combination
  • Fixed calculating correctly the 'y' at the end of a rowSpan with dontBreakRows

0.2.14 - 2024-10-09

  • Fixed drawing top horizontal line of the table with page break
  • Fixed uncaught Error when rowSpan and dontBreakRows combined

0.2.13 - 2024-09-22

  • Minimal supported version Node.js 18 LTS
  • Update Roboto font (version 3.010)
  • Fixed page break in a column group
  • Fixed saving margins in an unbreakable block
  • Fixed fillColor items in unbreakable blocks
  • Fixed calculating correctly the 'y' at the end of a rowSpan with dontBreakRows
  • Fixed margins (top/bottom) of nodes and row height are considered for breaking page
  • Fixed margins after page break
  • Fixed margins of nodes with relativePosition or absolutePosition are ignored and don't interfere with the regular flow of the layout

0.2.12 - 2024-08-14

  • Fixed error message of bad image definition

0.2.11 - 2024-08-09

  • Fixed and validates input values headerRows and keepWithHeaderRows
  • Fixed numbering nested ordered lists
  • Speed up StyleContextStack.autopush() for large tables
  • Fixed widths of table columns with percentages
  • Fixed storing the correct context in the ending cell of a row span when there were nested column groups (columns or tables)

0.2.10 - 2024-03-07

  • Removed unused brfs dependency

0.2.9 - 2024-01-01

  • Added padding option for QR code
  • Allow the document language to be specified
  • Fixed cover image size inside table
  • Fixed "Cannot read properties of undefined (reading 'bottomMost')" if table contains too few rows
  • Fixed invalid source-maps in builded js file

0.2.8 - 2023-11-09

  • Update pdfkit to 0.14.0
  • Update Roboto font (version 3.008)

0.2.7 - 2022-12-17

  • Fixed theoretical vulnerability CVE-2022-46161 (It was never part of version released as npm package or cdnjs or bower or packagist!)

0.2.6 - 2022-10-09

  • Updated Roboto font (version 3.005)
  • Fixed calculating auto page height
  • Fixed TrueType Collection loading from URL
  • Fixed refetching fonts from URL

0.2.5 - 2022-04-01

  • Support passing headers to request for loading font files and images via URL adresses

0.2.4 - 2021-11-10

  • Fixed destination path argument in VFS build script.
  • Fixed error "Object.isExtensible is not a function" (bug is in core-js version 3.19.1).

0.2.3 - 2021-11-06

  • Updated @foliojs-fork/pdfkit to version 0.13.0.
  • Tiling pattern support.
  • svg-to-pdfkit package moved as built-in. Solve not used installation of pdfkit.
  • Fixed passing document metadata.

0.2.2 - 2021-08-02

  • Fixed compatibility with Internet Explorer 11.

0.2.1 - 2021-08-02

0.2.0 - 2021-07-05