Document.Root loads a PDF and provides a PdfDocument to everything inside. src is reactive: changing it cancels the previous load and destroys the old document.
Anatomy
Copy to clipboard
Usage
- Sources: a URL string or
URL, anArrayBuffer/Uint8Array, aBlob/File,{ url, httpHeaders, withCredentials }, or an already-loaded pdf.js document. - States:
document.statusisidle·loading·password·ready·error;error.kindisinvalid,missing,network,passwordorunknown. - Utilities on the state:
getPage(n),getPageText(n),getProperties()(metadata, paper size, file size),download(name?, bytes?),print(bytes?),fingerprint(a stable key for saving notes).
Copy to clipboard
API reference
Document.Root
A provider: renders no element of its own.
Document.Loading
Renders a <div> (or your element via child) and accepts its HTML attributes.
No props of its own besides ref, child and children.
Data attributes
data-pdf-loadingDocument.Error
Renders a <div> (or your element via child) and accepts its HTML attributes.
No props of its own besides ref, child and children.
Data attributes
data-kinddata-pdf-errorDocument.Password
Renders a <form> (or your element via child) and accepts its HTML attributes.
No props of its own besides ref, child and children.
Data attributes
data-pdf-passworddata-reason