-
-
Notifications
You must be signed in to change notification settings - Fork 893
Upgrade guide from version 5.x to 6.x
React-PDF 6.x will receive updates that will break compatibility with React <16.8. For this reason, we're already dropping support for React versions older than 16.8 to give the team some breathing room.
React-PDF supports all modern browsers. It is tested with the latest versions of Chrome, Edge, Safari, Firefox, and Opera.
The following browsers are supported in React-PDF v6:
- Chrome ≥73
- Edge (Chromium-based)
- Safari ≥12.1
- Firefox ≥45(?)
If you need to support older browsers, you will need to use React-PDF v5. If you need to support Internet Explorer 11, you will need to use React-PDF v4.
If you want to use text layer in PDFs rendered by React-PDF, then you would need to include stylesheet necessary for text layer to be correctly displayed like so:
import 'react-pdf/dist/esm/Page/TextLayer.css';
If you returned React elements from customTextRenderer
, you'll now need to convert them to strings. In most cases, like highlighting specific text, it should be an easy fix. In others, renderToStaticMarkup
may help.
Previously, onGetTextSuccess
only got items
. To fix your callback, all you need to do is:
-function onGetTextSuccess(items) {
+function onGetTextSuccess({ items }) {
// …
To resolve peer dependency warnings on bundlers other than Webpack, file-loader
was changed from being a direct dependency to being an optional peer dependency. React-PDF 6.x will continue to work with Webpack 4. However, you'll need to manually install file-loader
package.