Observed since 20 Oct, 19:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A professional 3D PDF Flipbook library for the web.
A lightweight, professional, and responsive 3D PDF Flipbook library for the web.
Install the package via NPM:
=================================
First, add the library to your project via your package manager:Bash
npm install 3d-pro-flipbook
yarn add 3d-pro-flipbook
Import the class and the CSS. Create a container div with a unique ID
(e.g., #my-book).Initialize the book inside your framework's "Mounted" lifecycle hook (this ensures the HTML exists before the code runs).
Since this library interacts with the DOM (browser), you must use a Client Component and the useEffect hook. components/Flipbook.js
'use client'; // Required for Next.js 13+
import { useEffect } from 'react';
import { ProFlipbook } from '3d-pro-flipbook';
import '3d-pro-flipbook/style.css'; // Import styles
export default function Flipbook({ pdfUrl }) {
useEffect(() => {
// Init inside useEffect to ensure DOM is ready
new ProFlipbook('#my-book', pdfUrl, {
brandText: '3D Flip Book',
backgroundColor: '#333',
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no"
});
}, [pdfUrl]);
return (
<div id="my-book" style="width: 1200px; height: 80vh;"></div>
);
}
Use the onMounted hook to initialize the library.HTML
<script setup>
import { onMounted } from 'vue';
import { ProFlipbook } from '3d-pro-flipbook';
import '3d-pro-flipbook/style.css';
const pdfSource = '/book.pdf';
onMounted(() => {
new ProFlipbook('#vue-book', pdfSource, {
brandText: '3D Flip Book',
backgroundColor: '#333',
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no"
});
});
</script>
<template>
<div id="vue-book" style="width: 1200px; height: 80vh;"></div>
</template>
Initialize the library inside the ngAfterViewInit lifecycle method.book.component.ts TypeScript
import { Component, AfterViewInit } from '@angular/core';
import { ProFlipbook } from '3d-pro-flipbook';
// Ensure style.css is added to your angular.json styles array or imported in CSS
@Component({
selector: 'app-book',
template: '<div id="ng-book" style="width: 1200px; height: 80vh;"></div>'
})
export class BookComponent implements AfterViewInit {
ngAfterViewInit() {
new ProFlipbook('#ng-book', 'assets/book.pdf', {
brandText: '3D Flip Book',
backgroundColor: '#333',
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no"
});
}
}
Use the onMount function.
HTML
<script>
import { onMount } from 'svelte';
import { ProFlipbook } from '3d-pro-flipbook';
import '3d-pro-flipbook/style.css';
onMount(() => {
new ProFlipbook('#svelte-book', '/book.pdf', {
brandText: '3D Flip Book',
backgroundColor: '#333',
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no"
});
});
</script>
<div id="svelte-book" style="width: 1200px; height: 80vh;"></div>
If you aren't using a bundler, you can use the CDN links directly.
HTML
<link rel="stylesheet" href="https://unpkg.com/3d-pro-flipbook@latest/dist/style.css">
<div id="book-container" style="width: 1200px; height: 80vh;"></div>
<script src="https://unpkg.com/3d-pro-flipbook@latest/dist/pro-flipbook.umd.js"></script>
<script>
// Access via the global object 'ProFlipbook.ProFlipbook'
document.addEventListener('DOMContentLoaded', () => {
new ProFlipbook.ProFlipbook('#book-container', 'book.pdf', {
brandText: '3D Flip Book',
backgroundColor: '#333',
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no"
});
});
</script>
You can pass an options object as the third argument.
new ProFlipbook("#id", "file.pdf", {
soundUrl: './page-flip.mp3', // Give your own page flip sound file path
brandText: "3D Flip Book", // This text shown on the loader and book last page
backgroundColor: "#333", // The background color of the viewer area
brandFontColor: "#fff", // The brand title color in last page
pageBackgroundColor: "#5f5e5e", // This will apply to last page background color
pageFontColor: "#ffffff", // This will apply to loading text
brandLogo: "https://lh3.googleusercontent.com/a/ACg8ocJvulN68pLx-O-bP4k-dR2pWWBqSaJwMbCrWQ4iue63h80EXyU=s360-c-no" // The logo will be used in generated last page for Odd count files
});
Fix: Ensure you are initializing the code inside useEffect (React), onMounted (Vue), or ensure the component is client-side only ('use client').
Fix: Double-check your ID matches (#my-book vs id="my-book") and that you are using the correct lifecycle hook (e.g., useEffect with an empty dependency array []).
Fix: If loading a PDF from a different domain (e.g., AWS S3), ensure that server has CORS headers enabled (Access-Control-Allow-Origin: *).
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d59a51340d8b7321fb5ba2ef092798ccd0b3df0c11f2f74ce3de1154b79b108f