# What changed in pdfkit

> 22 changes in pdfkit 0.20 from its official release notes, upgrade guides and advisories: 6 breaking, 1 security, 7 new APIs and options. Each one cited. Sources checked 2026-10-19. HTML: https://unstale.sh/npm/pdfkit/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## pdfkit 0.20

### Breaking changes

- 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.1) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.1)
- AcroForm options are restricted to documented mappings and explicit escape hatches. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Throws when no ref is given instead of writing an unparseable undefined token into the /EmbeddedFiles name tree. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Annotation option keys are no longer automatically uppercased. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Browser applications must import each standard font they use and register it with registerStdFonts(); Node continues to load font metrics lazily. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- 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.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)

### Security

- Strings inside name trees are now encrypted. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)

### New APIs and options

- doc.font() now accepts already-parsed fontkit Font instances. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- LineWrapper is now available as a named export from the main Node and browser entry points. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- PDFDocument is now available as a named export from the main Node and browser entry points; the default export is preserved. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Register in-memory files globally in Node and browsers, optionally with birthtime and ctime metadata; passing undefined as data unregisters the path. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- registerFont now accepts already-parsed fontkit Font instances. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- An experimental helper under pdfkit/output returns a Promise resolving to a Blob containing the document output. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- An experimental helper under pdfkit/output returns a Promise resolving to a contiguous Uint8Array containing the document output. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)

### Fixes and other changes

- 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.2) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.2)
- doc.text() no longer throws `unsupported number: NaN` when lineBreak is false and underline, strike, link or goTo is used. (0.20.2) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.2)
- 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.2) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.2)
- Fixes invalid JavaScript emitted by date text field formatting, which prevented the format from being applied. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- doc.annotate() and its convenience methods no longer mutate the options passed to them. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Fixes repeated indentation across paragraphs and page breaks, and keeps the indent applied across continued text. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Font options are now persisted when adding a new page. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
- Fixes skipped holes in sparse arrays that shifted every later entry down one. (0.20.0) — [release notes](https://github.com/foliojs/pdfkit/releases/tag/v0.20.0)
