@fabiohvp/svelte-pdfjs
v0.0.14
Published
Svelte-pdfjs - a simple way to render your pdfs
Downloads
22
Readme
Svelte-pdfjs
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.
- You need to install rollup-plugin-node-builtins and rollup-plugin-copy (devDependencies)
- Inside your rollup.config.js you need to import them and do as follow:
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(),
...
]
...
};