Skip to content

fabiohvp/svelte-pdfjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Svelte-pdfjs

a simple way to render your pdfs. (only works with code-splitting)

npm install @fabiohvp/svelte-pdfjs
or
yarn add @fabiohvp/svelte-pdfjs

Sapper version needs to be imported as devDependency

Also this package requires some additional settings on rollup.

  1. You need to install rollup-plugin-node-builtins and rollup-plugin-copy (devDependencies)
  2. 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(),
		...
	]
	...
};

About

Simple wrapper for pdfjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published