Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Using pdfjs in Sveltekit/Typescript

$
0
0

I need to use pdfjs (current 4.1.392) for text extraction in a sveltekit 4 typescript project. This is how I try to import pdfjs into my src/routes/+page.svelte:

<script lang="ts">import * as pdfjs from 'pdfjs-dist/build/pdf';import pdfjsWorker from 'pdfjs-dist/build/pdf.worker';pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;</script>

However, I get the error message "Invalid 'workerSrc' type".

How can I use pdfjs in sveltekit/typescript?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>