Ahmad Faraz

Senior Frontend Developer

Introducing Pdf-viewer-core: A Modern React PDF Viewer Component

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: Getting Started Installation is straightforward using npm: npm install pdf-viewer-core…

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 onLoadSuccess and onLoadError callbacks
  • 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 toolbarStyles and containerStyles
  • 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

PropDescription
pdfFileThe PDF file to display (accepts File/URL/ArrayBuffer)
onLoadSuccessCallback when PDF loads successfully
onLoadErrorCallback when PDF fails to load
onPageChangeCallback when page changes
getPdfNameCallback to get PDF file name
showToolbarToggle toolbar visibility
toolbarConfigConfigure toolbar features
toolbarStylesCustom styles for toolbar
containerStylesCustom styles for container
fullScreenToggle fullscreen mode

Why Choose pdf-viewer-core?

  1. Modern Architecture: Built with current React best practices
  2. Performance: Optimized for fast rendering and smooth interactions
  3. Mobile-First: Works seamlessly across all devices
  4. Flexibility: Extensive customization options
  5. 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!

Support the Development


Leave a comment