Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

In the browser

Edit this page

@inkoxide/svelte/browser mounts the template in an element of no document and renders the PDF in a Web Worker, with @inkoxide/wasm installed:

  • createPdf(() => document, () => options) renders the document at once and whenever what the function reads changes, and gives blob, url, loading and error, and update(). Call it while a component is created; destroying the component stops the render and revokes the URL.
  • <PdfViewer {document}> shows the PDF in an <iframe>, in the browser's viewer (a fallback snippet before the first render, showToolbar={false} to hide the viewer's toolbar); <PdfDownloadLink {document} fileName="…"> is a link that downloads it, its children snippet given the render's state; <BlobProvider {document}> hands the state to its children snippet.
  • renderToBlob and renderToStream (a web stream).

They render again only when the document is another one: another component, or other prop values. Where the engine and the fonts come from, a CDN and Content Security Policy are in the React guide's In the browser.

Synced from packages/svelte/GUIDE.md in the inkoxide repository.