A modern web application that transforms any PDF into an interactive flipbook experience. Built with PDF.js and PageFlip library.
- PDF URL Support: Load PDFs directly from URLs
- Interactive Flipbook: Smooth page-turning animations
- Responsive Design: Works on desktop and mobile devices
- URL Parameters: Load PDFs via URL parameters
- Modern UI: Beautiful, intuitive interface
- Touch Support: Swipe gestures on mobile devices
- Node.js (v16 or higher)
- npm or yarn
-
Clone the repository
git clone <your-repo-url> cd pdf-flipbook
-
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
- Enter a PDF URL in the input field
- Click "Load PDF" or press Enter
- Wait for the PDF to load and convert to flipbook
Load a PDF directly via URL parameter:
http://localhost:3000?pdf=https://example.com/document.pdf
Click on any of the example PDF links to test the application.
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production build
pdf-flipbook/
├── src/
│ └── main.js # Main application logic
├── index.html # Main HTML file
├── package.json # Dependencies and scripts
├── vite.config.js # Vite configuration
└── README.md # This file
This project is configured for Railway deployment:
-
Connect to Railway
railway login railway link
-
Deploy
railway up
-
Set environment variables (if needed)
railway variables set NODE_ENV=production
The built application can be deployed to any static hosting service:
- Vercel
- Netlify
- GitHub Pages
- AWS S3
- etc.
The application uses a CDN-hosted PDF.js worker. To use a local worker:
-
Install the worker package:
npm install pdfjs-dist
-
Update the worker source in
src/main.js:pdfjsLib.GlobalWorkerOptions.workerSrc = '/node_modules/pdfjs-dist/build/pdf.worker.min.js';
Customize the flipbook behavior by modifying the PageFlip configuration in src/main.js:
pageFlip = new PageFlip(flipbookElement, {
width: 550, // Book width
height: 733, // Book height
size: 'stretch', // Size mode
minWidth: 315, // Minimum width
maxWidth: 1000, // Maximum width
minHeight: 400, // Minimum height
maxHeight: 1533, // Maximum height
maxShadowOpacity: 0.5, // Shadow opacity
showCover: true, // Show cover page
mobileScrollSupport: false // Mobile scroll support
});- CORS Errors: Ensure the PDF URL allows cross-origin requests
- Large PDFs: Very large PDFs may take time to load and convert
- Mobile Performance: Some mobile devices may struggle with large PDFs
Enable debug logging by opening the browser console and looking for detailed error messages.
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you encounter any issues or have questions, please open an issue on GitHub.