Skip to content

Upgrade guide from version 0.x to 1.x

Wojciech Maj edited this page Oct 12, 2018 · 3 revisions

Removed props

To avoid confusion on what props really mean, some props have been replaced with new ones. Arguments in new callbacks are similar, but slightly modified.

Removed prop Replaced with prop Comments
content file You can use file prop for all types of input now.
page pageIndex page was a number starting from 1. pageIndex starts from 0.
onDocumentComplete onDocumentLoad onDocumentComplete had total number of pages as an argument. onDocumentLoad has an object with total property (more to come).
onPageComplete onPageLoad onPageComplete had human-readable number of pages as an argument. onPageLoad has an object with pageIndex and pageNumber properties (more to come).

Additional notes

  • onPageComplete callback suggested that it was called after the page has been rendered. In fact, it was called when the page has been loaded to ReactPDF memory. Should you wish to keep this behavior, use onPageLoad. Should you rather have callback called when the user sees the page, use new onPageRender instead.