See Upgrade guide from version 1.x to 2.x.
What's new?
- Now there's more React in React. React-PDF's structure has been completely rewritten (#27).
- Documents are now loaded using
Document
component. - Pages are now rendered in
Page
components. They are meant to be rendered insideDocument
component. And yes, this means you can now render many pages at once! - You can render now table of contents using
Outline
component.
- Documents are now loaded using
- Support for text layers! This means the text rendered by
Page
component can be selected or read by a screen reader (nnarhinen/react-pdf#52). Rendering text layer is enabled by default, but you can disable it by usingrenderTextLayer
flag. - All React-PDF methods (
loadDocument
,loadPage
etc.) now return a promise for your convenience. onLoadSuccess
ofDocument
andPage
components now passpdf
andpage
respectively to their success handlers, giving you access to full PDF.js API.- New entry - entry.noloader - which gives you an ability not to create a separate thread for rendering PDFs. See README for more information.
- React-PDF now respects page's default rotation. In v1.x, rotation was always set to 0 unless
rotate
prop was passed. Now React-PDF renders pages in their default rotation as defined in PDF file. - Default entry will now display a warning if you're developing on a local file system.
- It's now easier to style No data, Error and Loading messages as they now have their own CSS classes.
- New sample PDFs were added.
- README file has been updated.
- Added instructions for non-Webpack projects.
- Added instructions for babel-polyfill.
- Sample and Test pages have been updated.
- Both pages are now mobile friendly.
- Sample page now renders an entire PDF at once.
- Test page now has an Outline section with sample navigation.
- Optimized NPM package. It no longer includes files not necessary for end user.
Bug fixes
- Fixed pages rendered sometimes being blurry due to the lack of rounding width/height down.
- Fixed PDF.js attempting to load worker from a random location (depending on the name of the last script included in head at the moment of loading PDF.js). It is now set to
pdf.worker.js
(nnarhinen/react-pdf#39). - React-PDF will no longer warn
Warning: setState(...): Can only update a mounted or mounting component.
if you unmount it while loading a file or rendering a page (#43).