Skip to content

Fix: Update pdfjs-dist dependency to include Safari compatibility fix #2020

@mohammadizanloo55

Description

@mohammadizanloo55

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

Hi 👋

react-pdf currently depends on an older version of pdfjs-dist.
The PDF.js team recently merged mozilla/pdf.js#20148, which fixes an important Safari compatibility issue:

  • FinalizationRegistry is only available in Safari 14.1+.
  • It cannot be polyfilled.
  • Without this fix, pdfjs-dist fails to work on older Safari versions (e.g. Safari 12, 13).

The fix defers initialization of IccColorSpace.#finalizer until after IccColorSpace.isUsable is checked, allowing custom builds to still run in legacy browsers.


Why this matters

  • Many users of react-pdf need to support Safari < 14.1.
  • Manually installing a newer pdfjs-dist causes version mismatch errors (API version … does not match Worker version …).
  • The only stable solution is for react-pdf to bump its pdfjs-dist dependency to the latest version containing this fix.

Expected outcome

Please update the pdfjs-dist dependency in react-pdf to at least the version that includes PR #20148.
This will restore compatibility with Safari < 14.1 and prevent breaking apps in production.

Thanks for your great work on maintaining this library 🙏

Steps to reproduce

  1. Install react-pdf in a project.
  2. Open a PDF in Safari 12 or 13.
  3. Observe the console or app crash due to FinalizationRegistry being undefined.

Expected behavior

  • PDF should load and render normally in Safari 12 and 13 without errors.
  • react-pdf should work in legacy browsers even though FinalizationRegistry is unavailable.

Actual behavior

  • PDF rendering fails in Safari 12/13.
  • The console shows an error like ReferenceError: FinalizationRegistry is not defined.
  • The app may crash or the PDF does not display.

Additional information

No response

Environment

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions