Turn any PDF into a flipbook.
Install
PDF support is a small add-on package so you only pull it in when you need it.
pnpm add @zinejs/core @zinejs/pdf pdfjs-distPdfSource
Pass a URL (or bytes). Under most bundlers the worker is auto-resolved with no config required for the common case.
import { Zine } from '@zinejs/core';
import { PdfSource } from '@zinejs/pdf';
const book = new Zine(document.getElementById('book'), {
source: new PdfSource('/catalog.pdf'),
});Options
// Vite / Nuxt: resolve the worker via ?url
import pdfWorker from 'pdfjs-dist/build/pdf.worker.min.mjs?url';
new PdfSource('/catalog.pdf', {
workerSrc: pdfWorker,
renderScale: 1,
preload: 1,
});workerSrc: optional; auto-resolved under Vite/webpackrenderScale: base raster scale (default1)preload: neighbor pages to prefetchmaxCacheBytes: LRU cache cap (default ~256 MB)
See the PDF example.