@tinyweb_dev/flipbuilder-core
v0.1.1
Published
Framework-agnostic core for Interactive Digital Flipbooks: PDF rendering, flip engine, search
Readme
@tinyweb_dev/flipbuilder-core
Framework-agnostic PDF loading, page rendering, spread layout, curl geometry, and page-turn state management for interactive flipbooks.
Installation
pnpm add @tinyweb_dev/flipbuilder-coreUsage
import {
FlipEngine,
PdfDocument,
} from "@tinyweb_dev/flipbuilder-core";
const document = await PdfDocument.load("/documents/catalog.pdf", {
workerSrc: "/pdf.worker.min.mjs",
});
const engine = new FlipEngine({
numPages: document.numPages,
viewMode: "spread",
coverPage: true,
duration: 600,
});
engine.on("spreadChanged", ({ spread }) => {
console.log(spread);
});
engine.flipNext();
engine.goToPage(10);
engine.dispose();
await document.destroy();PdfDocument.load accepts a URL, URL, ArrayBuffer, or Uint8Array and supports custom HTTP headers and credentials.
Main exports
PdfDocumentFlipEngineSpreadLayoutcomputeCurlGeometryRenderQueuePageCacheEventEmitter
See the project README for complete documentation and the React integration.
License
MIT
