A Svelte wrapper for PagedJS, providing easy pagination and print layout capabilities for your Svelte applications.
npm install svelte-pagedjs pagedjs
<script lang="ts">
  import { Pagedjs } from 'svelte-pagedjs';
  // Optional configuration
  const options = {
    enableContentEditable: true,
    autoResize: true,
    scaleWidth: 0.9,
    cssFiles: ['path/to/your/styles.css'],
    showMetrics: true
  };
</script>
<Pagedjs {...options}>
  <!-- Your content here -->
  <div>
    <h1>My Paged Content</h1>
    <p>This content will be paginated...</p>
  </div>
</Pagedjs>
| Option | Type | Default | Description | 
|---|---|---|---|
enableContentEditable | 
boolean | false | 
Makes the content editable after rendering | 
autoResize | 
boolean | false | 
Enables automatic resizing of content | 
scaleWidth | 
number | 0.9 | 
Scale factor for content width (0-1) | 
cssFiles | 
string[] | [] | 
Array of CSS file paths to apply | 
showMetrics | 
boolean | false | 
Shows rendering performance metrics | 
When showMetrics is enabled, the component displays a performance dashboard showing:
The component is SSR-friendly and automatically detects browser environment using esm-env.
Full TypeScript support is included. Types are exported for easy integration:
import type { PagedjsProps, PerformanceMetrics } from 'svelte-pagedjs';
<script lang="ts">
  import { Pagedjs } from 'svelte-pagedjs';
</script>
<Pagedjs
  enableContentEditable={true}
  autoResize={true}
  showMetrics={true}
>
  <article>
    <h1>Chapter 1</h1>
    <p>Your content here...</p>
  </article>
</Pagedjs>
The component automatically handles:
Works in modern browsers that support CSS Custom Properties and CSS Grid.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Built on top of PagedJS