svelte-pdf-kit Svelte Themes

Svelte Pdf Kit

A lightweight Svelte wrapper for PDF.js, adding features like virtualized scrolling and text search.

@santanu2310/svelte-pdf-kit

A minimal Svelte component for rendering multi-page PDFs, powered by PDF.js.

Installation

bun add @santanu2310/svelte-pdf-kit

or

npm i @santanu2310/svelte-pdf-kit

Usage

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>

Contributing

Setup and Running Instructions

  1. Clone the repository

    git clone https://github.com/santanu2310/svelte-pdf-kit.git
    cd svelte-pdf-kit
    
  2. Install dependencies

    bun install
    
  3. Start development server

    bun run dev
    

    This will start the development server where you can see the showcase app in src/routes.

  4. Build the library

    bun run build
    
  5. Lint and Format

    bun run lint
    bun run format
    

Top categories

Loading Svelte Themes