mozilla/pdf.js#12389 (comment)
It seems default import doesn't work, it works with namespace import import * as pdfjs from 'pdfjs-dist';.
My deepest appreciation to the author of this comment. Thanks man ๐
Alright, back to the grind. Hope this was helpful
- I installed
pdfjs-dist
as both, a normal, and as a developer dependency vianpm
. Ref https://www.reddit.com/r/sveltejs/comments/tgds5b/any_working_pdf_preview_library_for_sveltekit/i12sybc/, thanks a ton man. Strongly appreciated.
๐
- Do not mess with optimized dependencies, breaks library importing on the client side
- Ref wojtekmaj/react-pdf#782 (comment), or modify your
package.json
to copy the node_module's worker script to astatic
folder. First is easier, but leaks information to third-party services. Latter just takes a minute longer.
FYI, we also offer a PDF Viewer based on PDF.js which we made easy to use with any JS framework (React, Vue, Angular, Svelte, Blazor etc).
npm install pdfjskit
For details, please see:
https://github.com/GleamTech/PdfJsKit