Skip to content

Upgrade guide from version 2.x to 3.x

Wojciech Maj edited this page Mar 14, 2019 · 3 revisions

Styling

New styling methodology = new class names

To ensure testability and easier styling, some class names were changed. If you were using custom CSS styling, you'd need to adjust for that.

Old className New className
ReactPDF__Document react-pdf__Document
ReactPDF__Page react-pdf__Page
ReactPDF__Page__annotations react-pdf__Page__annotations
ReactPDF__Page__canvas react-pdf__Page__canvas
ReactPDF__Page__svg react-pdf__Page__svg
ReactPDF__Page__textContent react-pdf__Page__textContent
ReactPDF__Outline react-pdf__Outline
ReactPDF__Loader react-pdf__message, react-pdf__message--loading
ReactPDF__Error react-pdf__message, react-pdf__message--error
ReactPDF__NoData react-pdf__message, react-pdf__message--no-data

Document and Page components are now always rendering their containers. This means that messages (loading, error, no data) will now be rendered inside their component wrappers, not instead of them.

Annotations CSS are no longer automatically imported

Annotations rendered by PDF.js rely on a stylesheet, which previously was automatically imported by React-PDF. Some users were facing build issues caused by this file while having annotations disabled. Therefore, you need to import the file yourself if you choose to use annotations. See README.md for instructions.