Skip to content

spatial-monorepo


spatial-monorepo / editor/src / PDFDropOptions

Interface: PDFDropOptions

Defined in: packages/editor/src/usePDFDrop.ts:16

Properties

containerRef

containerRef: RefObject`<HTMLElement | null>`

Defined in: packages/editor/src/usePDFDrop.ts:18


onError?

optional onError?: (err) => void

Defined in: packages/editor/src/usePDFDrop.ts:27

Called when PDF rasterization fails — e.g. a corrupt/encrypted PDF, the consumer never installed pdfjs-dist, or the worker script failed to load. Mirrors useMVFDrop's onMVFImportError (issue #409) so the host app can render a visible banner instead of the drop silently doing nothing (issue #445). If omitted, failures are swallowed — always pass this in new code.

Parameters

err

Error

Returns

void


onImageReady

onImageReady: (blob, fileName) => void

Defined in: packages/editor/src/usePDFDrop.ts:17

Parameters

blob

Blob

fileName

string

Returns

void


pdfWorkerSrc?

optional pdfWorkerSrc?: string

Defined in: packages/editor/src/usePDFDrop.ts:39

Override for pdfjs-dist's worker script URL. By default the worker is configured with the Vite/Rollup-friendly new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url) pattern, which bundlers like Vite specifically detect and rewrite into a resolvable asset URL — no extra consumer setup required.

Bundlers that don't special-case new URL(bareSpecifier, import.meta.url) (e.g. a bare webpack config without asset/resource rules for .mjs workers, or a CDN-hosted worker script) must supply this explicitly.

Released under commercial licensing.