unstale

npm / pdfkit

pdfkit

What changed in pdfkit 0.18 to 0.20, from its official release notes, upgrade guides and advisories. Also covers @types/pdfkit. Sources checked 2026-11-30.

8 breaking1 security14 new APIs and options21 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

pdfkit 0.2022 changes

Breaking changes 6

  • In Node, importing pdfkit now resolves to a Node ESM build with the real file system, native zlib, Node streams, and self-registering standard fonts instead of the browser bundle.

    0.20.1release notes

  • AcroForm options are restricted to documented mappings and explicit escape hatches.

    0.20.0release notes

  • Throws when no ref is given instead of writing an unparseable undefined token into the /EmbeddedFiles name tree.

    0.20.0release notes

  • Annotation option keys are no longer automatically uppercased.

    0.20.0release notes

  • Browser applications must import each standard font they use and register it with registerStdFonts(); Node continues to load font metrics lazily.

    0.20.0release notes

  • The virtual file system was removed. Register in-memory data with registerFile, pass binary data directly to registerFont, image, or file, or pass data URLs to image and file.

    0.20.0release notes

Security 1

New APIs and options 7

  • doc.font() now accepts already-parsed fontkit Font instances.

    0.20.0release notes

  • LineWrapper is now available as a named export from the main Node and browser entry points.

    0.20.0release notes

  • PDFDocument is now available as a named export from the main Node and browser entry points; the default export is preserved.

    0.20.0release notes

  • Register in-memory files globally in Node and browsers, optionally with birthtime and ctime metadata; passing undefined as data unregisters the path.

    0.20.0release notes

  • registerFont now accepts already-parsed fontkit Font instances.

    0.20.0release notes

  • An experimental helper under pdfkit/output returns a Promise resolving to a Blob containing the document output.

    0.20.0release notes

  • An experimental helper under pdfkit/output returns a Promise resolving to a contiguous Uint8Array containing the document output.

    0.20.0release notes

Fixes and other changes 8

  • Calling doc.file() twice with the same in-memory attachment under one name no longer throws when deduplication checks dates that are absent for sources not read from disk.

    0.20.2release notes

  • doc.text() no longer throws unsupported number: NaN when lineBreak is false and underline, strike, link or goTo is used.

    0.20.2release notes

  • The mapping now resolves to a single file under all conditions, preventing bundlers and file tracers from packing ESM font metrics that cause runtime module-not-found errors.

    0.20.2release notes

  • Fixes invalid JavaScript emitted by date text field formatting, which prevented the format from being applied.

    0.20.0release notes

  • doc.annotate() and its convenience methods no longer mutate the options passed to them.

    0.20.0release notes

  • Fixes repeated indentation across paragraphs and page breaks, and keeps the indent applied across continued text.

    0.20.0release notes

  • Font options are now persisted when adding a new page.

    0.20.0release notes

  • Fixes skipped holes in sparse arrays that shifted every later entry down one.

    0.20.0release notes

pdfkit 0.1911 changes

Breaking changes 2

  • The minimum supported browsers are now Firefox 115 and iOS/Safari 16.

    0.19.0release notes

  • The minimum supported Node.js version is now 20+.

    0.19.0release notes

New APIs and options 4

  • Adds an opacity option to control image transparency.

    0.19.0release notes

  • Adds bbox support for PDF/UA compliance.

    0.19.0release notes

  • Adds placement support for PDF/UA compliance.

    0.19.0release notes

  • Adds borderRadius as a number for all corners or a per-corner array in CSS order.

    0.19.0release notes

Fixes and other changes 5

  • Fixes RGB JPEGs being embedded as DeviceGray, correcting how those images are handled.

    0.19.1release notes

  • Fixes PDF Name escaping for spot colors with spaces.

    0.19.0release notes

  • Fixes accessibility scope in TH elements.

    0.19.0release notes

  • Fixes PDF corruption when standard and embedded fonts share a postscript name.

    0.19.0release notes

  • Fixes handling of text input when x is null.

    0.19.0release notes

pdfkit 0.1811 changes

New APIs and options 3

  • Outlines can now jump to specific page positions with a custom zoom level.

    0.18.0release notes

  • Adds an option to control how pages are displayed in PDF viewers.

    0.18.0release notes

  • Adds an option for specifying custom page units, using PDF 1.6.

    0.18.0release notes

Fixes and other changes 8

  • Fixes indentation when indentAllLines is true and a new page is created.

    0.18.0release notes

  • Fixes incorrect rendering of interlaced PNG images with indexed transparency.

    0.18.0release notes

  • Adds robust handling for null byte padding in JPEG images.

    0.18.0release notes

  • Fixes accessibility issues with links in generated PDFs.

    0.18.0release notes

  • Adding outlines now preserves the existing PageMode instead of overwriting it.

    0.18.0release notes

  • Fixes parsing of SVG arc flags when they have no separators.

    0.18.0release notes

  • Fixes a table accessibility issue involving the CS/cs operator.

    0.18.0release notes

  • Fixes garbled text copying in Chrome and Edge for PDFs with more than 256 unique characters.

    0.18.0release notes