Skip to content

What is the difference between onLoadError, onLoadSucces and onSourceSuccess, onSourceError #881

Answered by wojtekmaj
joseDaKing asked this question in Q&A
Discussion options

You must be logged in to vote

When <Document /> is mounted and file prop is provided, React-PDF begins to load your file in two stages:

  • source
  • load

During source stage, document is retrieved from file prop.

onSourceSuccess is called when the document source is found and the file is actually about to begin loading or, somewhat controversially now that I think about it, when file is falsy and resolves to null, no file.

onSourceError is called when:

  • Invalid dataURI is provided and atob or unescape fails when trying to decode binary data
  • file is neither a string, nor PDFDataRangeTransport, nor ArrayBuffer, nor Blob (browser only), nor File (browser only), not an object.
  • file is an object, but neither url, nor data, nor r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wojtekmaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants