A robust PDF viewer component for Framer websites with intelligent fallback support and cross-platform compatibility.
- 🖥️ PDF.js Integration: Uses Mozilla's PDF.js for reliable PDF rendering
- 📱 Mobile Friendly: Works consistently across desktop and mobile browsers
- 🔄 Smart Fallbacks: Graceful degradation when embedding fails
- 🚀 Google Drive Support: Handles Google Drive URLs with direct download
- ⚙️ Framer Ready: Built specifically for Framer websites with property controls
- 🎨 Customizable: Full styling control through Framer properties
- Copy
PDFViewerFramer.jsx
to your Framer project - Import and use as a component in your Framer website
import PDFViewer from './PDFViewerFramer'
// Use with any PDF URL
<PDFViewer src="https://example.com/document.pdf" />
// Use with Google Drive
<PDFViewer src="https://drive.google.com/file/d/1ABC123.../view" />
// Use with local file (from same repo)
<PDFViewer src="./sample.pdf" />
The component includes these customizable properties in Framer:
- PDF URL: The URL or path to your PDF file
- Width: Component width (default: 100vw)
- Height: Component height (default: 100vh)
- Border Radius: Rounded corners in pixels
- Border Color: Border color (when enabled)
- Fallback Text: Custom text for download fallback
- Regular PDFs: Uses PDF.js viewer for embedded viewing
- Google Drive URLs: Automatically detects and provides download option
- Failed Loading: Falls back to download option after timeout
- Primary: PDF.js iframe viewer (for non-Google Drive URLs)
- Fallback: Download button with user-friendly messaging
Google Drive sharing URLs are automatically converted to direct download format:
From: https://drive.google.com/file/d/1ABC123.../view
To: https://drive.google.com/uc?export=download&id=1ABC123...
- ✅ Chrome (Desktop & Mobile)
- ✅ Safari (Desktop & Mobile)
- ✅ Firefox (Desktop & Mobile)
- ✅ Edge (Desktop & Mobile)
- ✅ iOS Safari
- ✅ Android Chrome
framer-pdf-viewer/
├── PDFViewerFramer.jsx # Main component
├── sample.pdf # Test PDF file
├── package.json # Project metadata
└── README.md # This file
Test the component with the included sample PDF:
<PDFViewer src="./sample.pdf" />
- Google Drive CORS: Google Drive URLs cannot be embedded due to CORS restrictions
- File Size: Very large PDFs may take time to load
- Network: Requires internet connection for PDF.js CDN
- Fork the repository
- Create your feature branch
- Make your changes
- Test across different browsers and devices
- Submit a pull request
MIT License - feel free to use in your Framer projects!
If you encounter issues:
- Check browser console for error messages
- Verify PDF URL is accessible
- Test with the included sample.pdf file
- Open an issue with details about your setup
Built for the Framer community 🎨