Releases: wojtekmaj/react-pdf
v10.1.0
What's new?
- Added support for functions as children. React-PDF has never been simpler to work with! Say goodbye to
onLoadSuccess
, say goodbye to setting number of pages in your own state, say goodbye to extra renders! Now, rendering a simple document is as trivial as:Thanks @adamaoc for inspiration!<Document file="sample.pdf"> {({ pdf }) => Array(pdf.numPages) .fill(null) .map((_, index) => <Page key={index} pageIndex={index} /> ))} </Document>
- Updated PDF.js to 5.3.93.
- Updated documentation on JPEG 2000 support.
- Updated dependencies.
- Exported
LinkService
type for convenience.
What's changed?
usePageContext
will now provide non-null value sooner than before, before the page is actually loaded. This is uniform with howuseDocumentContext
behaves and with how types were designed from the start, so you should not be affected by this change.- React-PDF now targets es2018 and not es2017. PDF.js, our core dependency, already used modern JavaScript syntax, so you should not be affected by this change.
v10.0.1
v10.0.0
See Upgrade guide from version 9.x to 10.x.
After more than a year since our last major release, we're thrilled to bring you React-PDF 10.
This update includes a major PDF.js upgrade, new features to make your life easier, improved stability, and some important breaking changes.
👀 Want to see exciting features more often? Consider sponsoring React-PDF.
❗️ = breaking change
What's new?
- ❗️ Dropped CommonJS build, making the package ESM-only. Chances are you're not going to be affected by this change at all, as all common bundlers support ESM out of the box.
- However, you may encounter issues running unit tests using Jest. Consider migrating to Vitest.
- Updated PDF.js to 5.3.31.
- Performance boosts: Key rendering routines refactored to cut memory usage and speed up page loading.
- JPEG2000 downscaling: Automatic downscale of large JPEG2000 images during decoding to improve render times.
- CMYK JPEG fix: Correct handling of the alpha channel when WebAssembly is disabled.
- Viewer stability: Better handling of missing/invalid Content-Range headers.
- API cleanup: Removed deprecated options, adopted parameter objects for core methods, and introduced private class fields for cleaner code.
- Added support for
scale
prop inDocument
component, allowing you to set the scale for the entire document. - Reexported some commonly used types from
pdfjs-dist
, such asStructTreeNode
,TextContent
,TextItem
, andTextMarkedContent
, making it easier to work with PDF.js-provided types in your application.
What's changed?
- ❗️ Dropped support for older browsers and Node.js versions. Please note that following PDF.js's lead, React-PDF will now guarantee to support only the latest versions of all major modern browsers.
- Improved, cleaned up documentation.
- We're now testing React-PDF with Vitest Browser Mode, ensuring better compatibility with modern browsers.
v9.2.1
v9.2.0
v9.1.1
v9.1.0
What's new?
- Updated PDF.js to 4.4.168.
- Annotation improvements
- Font conversion improvements
- Image decoding improvements
- Performance improvements
- Text selection improvements
- Added support for
isolatedDeclarations
in TypeScript.
What's changed?
- Updated documentation.
- Updated Next.js, Parcel and Webpack examples.
Bug fixes
- Fixed missing hiddenCanvasElement styles (#1815).
- Fixed overly large
structTreeUtils.d.ts
file, saving you 45 KB of disk space.
v9.0.0
See Upgrade guide from version 8.x to 9.x.
This version updates PDF.js to 4.3.136, fixing GHSA-wgrm-67xf-hhpq for good. React-PDF v8.0.2 and v7.7.3 have already included a mitigation of the issue and thus were not affected by this vulnerability, but caused automatic security alerts due to the outdated PDF.js version.
❗️ = breaking change
What's new?
- Updated PDF.js to 4.3.136.
- Optimizations for CPU and memory usage
- Performance improvements
- Image rendering improvements
- Text selection improvements
- Accessibility improvements
- Font conversion improvements
- Handling of corrupted documents
- Improved Turbopack compatibility.
What's changed?
- ❗️ PDF.js worker extension has been changed from
.js
to.mjs
. - ❗ PDF.js is now an ESM module.
- In particular, you may encounter issues running unit tests using Jest. Consider migrating to Vitest.
- Next.js also have issues with ESM Workers, but a working configuration is already known - see Upgrade guide and updated samples.
- ❗️ Removed deprecated
svg
renderMode
. - ❗️ Dropped support for older browsers and Node.js versions. In particular, you may need
Promise.withResolvers
polyfill when running Node.js versions older than 22.0.0.
v8.0.2
Bug fixes
- Force
isEvalSupported
tofalse
. Fixes GHSA-87hq-q4gp-9wr4 (caused by GHSA-wgrm-67xf-hhpq).
v8.0.1
This version shipped an incorrect fix for a security vulnerability and thus has been deprecated.
Bug fixes
ForceisEvalSupported
totrue
. Fixes GHSA-87hq-q4gp-9wr4 (caused by GHSA-wgrm-67xf-hhpq).