GitHub

Adex React PDF Viewer

npm install adex-react-pdf-viewer
Current theme: default-theme (auto-changing)

/ ?

Created with by Abhishek

Features

A powerful, feature-rich PDF viewer component for React applications. Built on top of react-pdf, AdexViewer provides a complete solution for viewing, annotating, and interacting with PDF documents.

Document Navigation

Page thumbnails, navigation controls, and smooth scrolling between pages for easy document navigation.

Advanced Search

Full-text search with result highlighting, navigation between search results, and a results sidebar.

Rich Annotations

Add notes, highlights, and drawings to your documents with customizable colors and persistent storage.

Bookmarks & Outline

Support for PDF outlines and custom bookmarks with localStorage persistence for easy navigation.

Document Handling

Print support with customizable options, direct download, and document information panel.

Responsive Design

Optimized for both desktop and mobile devices with a responsive layout that adapts to any screen size.

Internationalization

Support for 35+ languages with easy language switching and customizable translations for all UI elements.

Multiple Themes

Choose from 13 built-in themes including dark mode, high contrast, sepia, and professional styles to customize the viewer's appearance.

Installation

Get started with AdexViewer in your React application with just a few simple steps.

npm install adex-react-pdf-viewer

Basic Usage

Integrate AdexViewer into your React application with just a few lines of code.

import React from "react";
import AdexViewer from "adex-react-pdf-viewer";
import "adex-react-pdf-viewer/index.css"; // Import styles

function App() {
  return (
    <div style={{ height: "100vh" }}>
      <AdexViewer
        data={{ url: "https://example.com/sample.pdf" }}
      />
    </div>
  );
}

export default App;

API Reference

Customize AdexViewer to fit your needs with these configuration options.

Props

Prop Type Description Default
data object { url: string } - URL of the PDF file to display Required
credits boolean Show or hide attribution credits true
showSidebar boolean Show or hide the sidebar on initial load false
showToolbar boolean Show or hide the toolbar true
showControls object Configure which controls to display See below
defaultValues object Set default zoom, page, and fullscreen state See below
responsive object Configure responsive behavior See below
textOptions object Configure text selection and copying See below
printOptions object Configure print behavior See below
localization array Configure language options for the viewer interface See below

showControls Object

showControls: {
  navigation: true,      // Page navigation controls
  zoom: true,            // Zoom controls
  fullscreen: true,      // Fullscreen button
  download: true,        // Download button
  info: true,            // Document info button
  sidebarButton: true,   // Sidebar toggle button
  rotation: true,        // Page rotation controls
  print: true,           // Print button
  search: true,          // Search functionality
  bookmarks: true,       // Bookmarks functionality
  annotations: true,     // Annotations functionality
  localization: true     // Language selection button
}

defaultValues Object

defaultValues: {
  zoom: 1.25,            // Initial zoom level (0.5 to 3)
  page: 1,               // Initial page number
  fullscreen: false      // Start in fullscreen mode
}

textOptions Object

textOptions: {
  enableSelection: true,   // Allow text selection
  enableCopy: true         // Allow text copying
}

printOptions Object

printOptions: {
  printBackground: true,     // Print background graphics
  pageRangeEnabled: true     // Enable page range selection
}

localization Array

localization: [
  { locale: "en", title: "English", active: true },
  { locale: "ar", title: "العربية", active: false },
  { locale: "bg", title: "Български", active: false },
  { locale: "bn", title: "বাংলা", active: false },
  { locale: "ca", title: "Català", active: false },
  { locale: "cs", title: "Čeština", active: false },
  { locale: "de", title: "Deutsch", active: false },
  { locale: "el", title: "Ελληνικά", active: false },
  { locale: "es", title: "Español", active: false },
  { locale: "fi", title: "Suomi", active: false },
  { locale: "fr", title: "Français", active: false },
  { locale: "he", title: "עברית", active: false },
  { locale: "hi", title: "हिन्दी", active: false },
  { locale: "id", title: "Bahasa Indonesia", active: false },
  { locale: "it", title: "Italiano", active: false },
  { locale: "ja", title: "日本語", active: false },
  { locale: "ko", title: "한국어", active: false },
  // ... and many more languages
]

Each language object contains:

Supported Languages

AdexViewer comes with support for 35+ languages including:

Language Code Language Name
en English
ar العربية (Arabic)
bg Български (Bulgarian)
bn বাংলা (Bengali)
ca Català (Catalan)
cs Čeština (Czech)
de Deutsch (German)
el Ελληνικά (Greek)
es Español (Spanish)
fi Suomi (Finnish)
fr Français (French)
he עברית (Hebrew)
hi हिन्दी (Hindi)
id Bahasa Indonesia
it Italiano (Italian)
ja 日本語 (Japanese)
ko 한국어 (Korean)
mr मराठी (Marathi)
ms Bahasa Melayu
nl Nederlands (Dutch)
no Norsk (Norwegian)
pa ਪੰਜਾਬੀ (Punjabi)
pl Polski (Polish)
pt Português
ro Română (Romanian)
ru Русский (Russian)
sv Svenska (Swedish)
sw Kiswahili (Swahili)
ta தமிழ் (Tamil)
te తెలుగు (Telugu)
th ไทย (Thai)
tr Türkçe (Turkish)
uk Українська (Ukrainian)
vi Tiếng Việt (Vietnamese)
zh-CN 简体中文 (Simplified Chinese)
zh_TW 繁體中文 (Traditional Chinese)

🎨 Themes

AdexViewer comes with multiple built-in themes to customize the appearance of the viewer.

Using Themes

To use a theme, you need to:

  1. Import the theme CSS file:

    import "adex-react-pdf-viewer/themes/blue-theme.css";
  2. Provide the theme name to the component:

    <AdexViewer
      data={{ url: "https://pdfobject.com/pdf/pdf_open_parameters_acro8.pdf" }}
      theme="blue-theme"
    />

Available Theme Options

The following themes are available:

Theme Name Description
"default-theme" The standard theme with a clean, neutral design suitable for most applications
"blue-theme" A modern theme with blue accents and a professional appearance
"dark-theme" Dark background with light text, ideal for low-light environments and reducing eye strain
"minimal-theme" A simplified interface with reduced visual elements for a distraction-free reading experience
"corporate-theme" Formal design with subtle colors suitable for business and enterprise applications
"professional-theme" Polished interface with refined controls and balanced color scheme
"high-contrast-theme" Enhanced contrast between elements for improved accessibility and readability
"night-mode-theme" Dark background with optimized colors for nighttime reading
"sepia-theme" Warm, yellowish-brown tones that reduce eye strain for extended reading sessions
"retro-theme" Nostalgic design inspired by classic windown 95 style document viewers
"adobe-theme" Inspired by Adobe's PDF viewer interface for users familiar with that environment
"microsoft-theme" Design elements reminiscent of Microsoft's document viewing applications
"acrobat-theme" Styled after Adobe Acrobat's interface for a familiar experience

Development

Contribute to AdexViewer or customize it for your specific needs.

Clone the Repository

git clone https://github.com/abhibagul/Adex-React-PDF-Viewer.git
cd Adex-React-PDF-Viewer
npm install

Build the Package

npm run build

Link and Use in Your Project

npm link