a simple way to render your pdfs. (only works with code-splitting)
npm install @fabiohvp/svelte-pdfjs
oryarn add @fabiohvp/svelte-pdfjs
Sapper version needs to be imported as devDependency
Also this package requires some additional settings on rollup.
import builtins from "rollup-plugin-node-builtins";
import copy from "rollup-plugin-copy";
...
export default {
...
plugins: [
...
copy({
targets: [
{
src: "node_modules/pdfjs-dist/build/pdf.worker.min.js",
dest: "public/pdfjs"
},
{
src: "node_modules/pdfjs-dist/cmaps/**/*",
dest: "public/pdfjs/cmaps"
}
]
}),
...
resolve({
...
preferBuiltins: true
}),
builtins(),
...
]
...
};