4.9: glyphs missing from rendered PDF when multiple documents are rendered in one process (regression from 4.3)

Open
#3,589 0 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@iliev-blnk is already working on this.

Since Oct 22, 2026.

  • #3601 by @iliev-blnk — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
backend

Research direction

Start by reproducing with two renderToBuffer calls in one Node process, with the second document using bold/semibold glyphs the first did not, and compare against a fresh-process render. The payload points at font and subset state in @react-pdf/font and the switch to upstream pdfkit, plus the ToUnicode CMap output in the PDF. Done means sequential renders produce the same glyphs and CMap as isolated renders, with no empty bfrange destinations.

Written by the indexing model from the issue text.

Description

Describe the bug
Since upgrading from @react-pdf/renderer 4.3.2 to 4.9.0, glyphs occasionally disappear from the rendered page when several documents are rendered in the same Node process. The failure depends on render order: the same document rendered alone in a fresh process is correct.

Observed: a short bold/semibold label WO (Inter, ~7pt, registered via Font.register with local TTFs for weights 400/500/600/700) renders as O. The W is missing visually, not just from the text layer. The same string in regular weight on the same page renders fine. In the same output, the ToUnicode CMap sometimes contains an empty destination (<>) inside a bfrange array for a glyph that was used in an earlier render, so copy/search also lose characters (e.g. umlauts).

4.3.2 renders the identical sequence of documents correctly, pixel for pixel.

To Reproduce

  1. Register Inter (multiple weights) with Font.register.
  2. In one Node process, call renderToBuffer on several different documents in sequence that share the font but use different character sets in bold/semibold runs.
  3. Rasterize the later documents: some glyphs in bold/semibold runs are missing. Rendering the affected document first, or in a fresh process, shows them correctly.

Expected behavior
Each renderToBuffer call is independent of previous renders; all glyphs are drawn.

Environment

  • @react-pdf/renderer 4.9.0 (@react-pdf/layout 5.2.0, @react-pdf/textkit 7.0.1, @react-pdf/render 4.7.0, @react-pdf/font 4.1.2, pdfkit 0.20.1)
  • Node 24.11 / Node 22 (server-side rendering in a long-lived Next.js server)
  • Not reproducible on 4.3.2 (@react-pdf/pdfkit 4.1.0, textkit 6.1.0)

Possibly related to the switch from @react-pdf/pdfkit to upstream pdfkit: font/subset state appears to carry over between documents.

Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
11m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diegomura/react-pdf

All issues in diegomura/react-pdf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.