Web SDKv1.0.0

PDFDocument.whenFullyLoaded()

Only meaningful after fromUrlProgressive(). Resolves once every byte has arrived. Editing, export and search need this, which the background fill reaches shortly after opening. When the download can never finish the document stays open for viewing, and a viewer showing it reports the same once on its error event.
methodLifecyclesince 1.0.0

Signature

whenFullyLoaded(): Promise<void>

Returns

Promise<void> Resolves once every byte has arrived.

Throws

  • NETWORK_ERROR — the download can never finish (a range request kept failing through its retries).
  • ABORTED — the signal was aborted.

Example

TypeScript
const doc = await PDFDocument.fromUrlProgressive('/big-report.pdf');
await doc.whenFullyLoaded();
const hits = await doc.text.search('Total');

More in PDFDocument