# Web Workers

- Human documentation: [https://docs.univer.ai/guides/pdfs/getting-started/worker](https://docs.univer.ai/guides/pdfs/getting-started/worker)

- Agent Markdown: [https://docs.univer.ai/guides/pdfs/getting-started/worker.md](https://docs.univer.ai/guides/pdfs/getting-started/worker.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.3`

- Source: [pdfs/getting-started/worker.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/pdfs/getting-started/worker.mdx)

---

PDFs supports Worker[^web-worker] rendering of page thumbnails. Pass `thumbnailWorkerURL` to `UniverPdfsUIPlugin`; the Worker uses `OffscreenCanvas`. This setting does not move the whole PDF editor into a Worker.

Start with [installation and basic usage](https://docs.univer.ai/guides/pdfs/getting-started/installation.md). The following snippets extend that setup. Register the plugins before creating or loading content; replace existing registrations rather than registering a plugin twice.

## Main thread

```typescript title="main.ts"
import { UniverPdfsUIPlugin } from '@univerjs-pro/pdfs-ui'

univer.registerPlugin(UniverPdfsUIPlugin, {
  thumbnailWorkerURL: new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' }),
})
```

## Worker entry

```typescript title="worker.ts"
import { startPdfPageThumbnailWorker } from '@univerjs-pro/pdfs-ui'

startPdfPageThumbnailWorker()
```

Use a module Worker and a separate entry file. Keep the Worker and main-thread package versions aligned. Rendering and user interaction stay on the main thread.

[^web-worker]: A Web Worker runs JavaScript outside the browser’s main thread and exchanges messages with it. It cannot access the page DOM directly; moving calculations into a Worker does not move the editor UI there.
