A minimal Svelte component for rendering multi-page PDFs, powered by PDF.js.
bun add @santanu2310/svelte-pdf-kit
or
npm i @santanu2310/svelte-pdf-kit
PDF.js requires browser APIs, so ensure the component is rendered on the client side. In SvelteKit, you can disable SSR for the page or use a client-side check.
<script lang="ts">
import { PdfViewer } from '@santanu2310/svelte-pdf-kit';
// Ensure the component is rendered on the client side
export const ssr = false;
</script>
<div class="pdf-viewer">
<PdfViewer url="./sample.pdf" />
</div>
Clone the repository
git clone https://github.com/santanu2310/svelte-pdf-kit.git
cd svelte-pdf-kit
Install dependencies
bun install
Start development server
bun run dev
This will start the development server where you can see the showcase app in src/routes.
Build the library
bun run build
Lint and Format
bun run lint
bun run format