Are you looking for a powerful, flexible PDF viewer for your React applications? Meet pdf-viewer-core, a modern PDF viewer component that combines performance with extensive customization options.
What Makes pdf-viewer-core Special?
This package stands out with its impressive feature set:
- Lightning-fast PDF rendering for smooth user experience
- Full mobile responsiveness with touch support
- Highly customizable UI components
- Seamless page navigation and smooth scrolling
- Versatile file handling (supports files, URLs, and ArrayBuffer)
- Feature-rich toolbar with configurable controls
- Flexible styling options to match your application’s design
Getting Started
Installation is straightforward using npm:
npm install pdf-viewer-core
Basic implementation is just as simple:
import { PDFViewer } from 'pdf-viewer-core';
import 'pdf-viewer-core/style.css';
function YourComponent() {
return <PDFViewer pdfFile={yourPdfFile} />;
}
Customization Options
The component offers extensive customization through props:
Core Features:
- Load PDFs from files, URLs, or ArrayBuffer
- Track loading status with
onLoadSuccessandonLoadErrorcallbacks - Monitor page changes with
onPageChange - Retrieve PDF file names using
getPdfName
UI Customization:
- Toggle toolbar visibility with
showToolbar - Configure toolbar features using
toolbarConfig - Customize styling with
toolbarStylesandcontainerStyles - Enable fullscreen mode with
fullScreen
Example with Custom Configuration:
<PDFViewer
pdfFile={pdfUrl}
showToolbar={true}
toolbarConfig={{ showPageNavigation: true }}
containerStyles={{ maxHeight: '80vh', width: '100%' }}
onPageChange={(page) => console.log(`Current page: ${page}`)}
onLoadSuccess={() => console.log('PDF loaded successfully')}
/>
Available Props
| Prop | Description |
|---|---|
pdfFile | The PDF file to display (accepts File/URL/ArrayBuffer) |
onLoadSuccess | Callback when PDF loads successfully |
onLoadError | Callback when PDF fails to load |
onPageChange | Callback when page changes |
getPdfName | Callback to get PDF file name |
showToolbar | Toggle toolbar visibility |
toolbarConfig | Configure toolbar features |
toolbarStyles | Custom styles for toolbar |
containerStyles | Custom styles for container |
fullScreen | Toggle fullscreen mode |
Why Choose pdf-viewer-core?
- Modern Architecture: Built with current React best practices
- Performance: Optimized for fast rendering and smooth interactions
- Mobile-First: Works seamlessly across all devices
- Flexibility: Extensive customization options
- Easy Integration: Simple to implement and configure
Conclusion
pdf-viewer-core brings professional PDF viewing capabilities to your React applications with minimal effort. Whether you’re building a document management system, an e-learning platform, or any application that needs PDF viewing capabilities, this package provides the features you need with the flexibility to make it your own.
Ready to enhance your application with powerful PDF viewing capabilities? Get started with pdf-viewer-core today!
Leave a comment