HelpBot Assistant

How can I help you?

Events in React PDF Viewer

25 Feb 202624 minutes to read

The PDF Viewer component triggers events for component creation, page navigation, document lifecycle, context menu interactions, comments, bookmarks, download/export, hyperlinks, annotation import/export, custom keyboard commands, printing, signatures, text search, and text selection. These events enable integration of custom logic into application workflows.

The following table lists commonly used events supported by the PDF Viewer component:

Event Description
bookmarkClick Triggers when a bookmark item is clicked in the bookmark panel.
buttonFieldClick Triggers when a button form field is clicked.
commentAdd Triggers when a comment is added to the comment panel.
commentDelete Triggers when a comment is deleted from the comment panel.
commentEdit Triggers when a comment is edited in the comment panel.
commentSelect Triggers when a comment is selected in the comment panel.
commentStatusChanged Triggers when a comment’s status changes in the comment panel.
created Triggers during the creation of the PDF Viewer component.
customContextMenuBeforeOpen Fires before the custom context menu opens.
customContextMenuSelect Fires when a custom context menu item is selected.
documentLoad Triggers while loading a document into the PDF Viewer.
documentLoadFailed Triggers when document loading fails.
documentUnload Triggers when the document is closed.
downloadEnd Triggers after a document is downloaded.
downloadStart Triggers when the download action is initiated.
exportFailed Triggers when exporting annotations fails.
exportStart Triggers when exporting annotations starts.
exportSuccess Triggers when annotations are exported successfully.
extractTextCompleted Triggers when text extraction is completed.
hyperlinkClick Triggers when a hyperlink is clicked.
hyperlinkMouseOver Triggers when hovering over a hyperlink.
importFailed Triggers when importing annotations fails.
importStart Triggers when importing annotations starts.
importSuccess Triggers when annotations are imported successfully.
keyboardCustomCommands Triggers when customized keyboard command keys are pressed.
moveSignature Triggers when a signature is moved across the page.
pageChange Triggers when the current page number changes.
pageClick Triggers when a mouse click occurs on a page.
pageMouseover Triggers when moving the mouse over a page.
pageOrganizerSaveAs Triggers when a save as action is performed in the page organizer.
pageRenderComplete Triggers after a page finishes rendering.
pageRenderInitiate Triggers when page rendering begins.
printEnd Triggers when a print action is completed.
printStart Triggers when a print action is initiated.
removeSignature Triggers when a signature is removed.
resizeSignature Triggers when a signature is resized.
resourcesLoaded Triggers after PDFium resources are loaded.
signaturePropertiesChange Triggers when signature properties are changed.
signatureSelect Triggers when a signature is selected.
signatureUnselect Triggers when a signature is unselected.
textSearchComplete Triggers when a text search is completed.
textSearchHighlight Triggers when the searched text is highlighted.
textSearchStart Triggers when a text search is initiated.
textSelectionEnd Triggers when text selection is complete.
textSelectionStart Triggers when text selection is initiated.
thumbnailClick Triggers when a thumbnail is clicked.
toolbarClick Triggers when a toolbar item is clicked.
validateFormFields Triggers when form field validation fails.
zoomChange Triggers when the magnification value changes.

Note: For annotation and signature events, see the dedicated Annotations Events topic.

bookmarkClick

The bookmarkClick event triggers when a bookmark item is clicked in the bookmark panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      bookmarkClick={(args) => {
        console.log(`Bookmark clicked: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

toolbarClick

The toolbarClick event triggers when a toolbar item is clicked. Use it to handle actions based on the clicked item’s id or name.

  • Event arguments: ClickEventArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      toolbarClick={(args) => {
        console.log(`Toolbar item clicked: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

validateFormFields

The validateFormFields event triggers when form field validation fails, typically before a download or submit action proceeds. Use this event to inspect which required fields are empty and show custom messages or block application logic if needed.

  • Event arguments: ValidateFormFieldsArgs
    • name: Event name
    • documentName: Current document name
    • formField: The last interacted field’s data (if applicable)
    • nonFillableFields: Array detailing required/invalid fields

When it triggers

  • Add a form field and mark it Required (UI: right‑click field > Properties > Required).
  • Leave the field empty and click Download. The event fires and provides the list of fields that failed validation.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/form-designer.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      enableFormFieldsValidation={true}
      validateFormFields={(args) => {
        console.log('form field event name:', args.name);
        console.log('form field document name:', args.documentName);
        console.log('form field data:', args.formField);
        console.log('non fillable form field details:', args.nonFillableFields);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

Tip

  • To require a field programmatically, set isRequired: true when creating or editing the field via Form Designer APIs.

zoomChange

The zoomChange event triggers when the magnification value changes.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      zoomChange={(args) => {
        console.log(`Zoom changed to: ${args.zoomValue}%`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

buttonFieldClick

The buttonFieldClick event triggers when a button form field is clicked.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      buttonFieldClick={(args) => {
        console.log(`Button field clicked. Name: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

commentAdd

The commentAdd event triggers when a comment is added in the comment panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      commentAdd={(args) => {
        console.log(`Comment added. Id: ${args.id}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

commentDelete

The commentDelete event triggers when a comment is deleted in the comment panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      commentDelete={(args) => {
        console.log(`Comment deleted. Id: ${args.id}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

commentEdit

The commentEdit event triggers when a comment is edited in the comment panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      commentEdit={(args) => {
        console.log(`Comment edited. Id: ${args.id}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

commentSelect

The commentSelect event triggers when a comment is selected in the comment panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      commentSelect={(args) => {
        console.log(`Comment selected. Id: ${args.id}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

commentStatusChanged

The commentStatusChanged event triggers when a comment status is changed in the comment panel.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      commentStatusChanged={(args) => {
        console.log(`Comment status changed. Id: ${args.id}, Status: ${args.status}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

created

The created event is triggered during the creation of the PDF Viewer component.

  • Event arguments: void.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      created={() => {
        console.log('PDF Viewer created');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

customContextMenuBeforeOpen

The customContextMenuBeforeOpen event fires just before the context menu is shown. Use it to show or hide items based on the current state (for example, only show search items when text is selected).

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  const menuItems = React.useMemo(() => ([
    {
      text: 'SEARCH_ON_WEB',
      id: 'web_search',
      iconCss: 'e-icons e-search',
      items: [
        { text: 'SEARCH_IN_GOOGLE_IMAGE', id: 'web_search_images' },
        { text: 'SEARCH_IN_WIKIPEDIA', id: 'web_search_wikipedia' },
        { text: 'SEARCH_IN_YOUTUBE', id: 'web_search_youtube' },
        { text: 'SEARCH_GOOGLE', id: 'web_search_google' },
      ],
    },
    { id: 'web_search_separator', separator: true },
  ]), []);

  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      customContextMenuBeforeOpen={(args) => {
        console.log(`Before open context menu at page ${args.name}`);
      }}
      documentLoad={() => {
        viewer.current.addCustomMenu(menuItems, false, false);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

customContextMenuSelect

The customContextMenuSelect event fires when a custom menu item is clicked. Use it to branch logic by the clicked item’s id.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  const menuItems = React.useMemo(() => ([
    {
      text: 'SEARCH_ON_WEB',
      id: 'web_search',
      iconCss: 'e-icons e-search',
      items: [
        { text: 'SEARCH_IN_GOOGLE_IMAGE', id: 'web_search_images' },
        { text: 'SEARCH_IN_WIKIPEDIA', id: 'web_search_wikipedia' },
        { text: 'SEARCH_IN_YOUTUBE', id: 'web_search_youtube' },
        { text: 'SEARCH_GOOGLE', id: 'web_search_google' },
      ],
    },
    { id: 'web_search_separator', separator: true },
  ]), []);

  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      customContextMenuSelect={(args) => {
        console.log(`Context menu item selected: ${args.name}`);
      }}
      documentLoad={() => {
        viewer.current.addCustomMenu(menuItems, false, false);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

documentLoad

The documentLoad event occurs after a document is successfully loaded and parsed.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      documentLoad={(args) => {
        console.log(`Document loaded: page count = ${args.pageData}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

documentLoadFailed

The documentLoadFailed event triggers when loading a document fails.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/invalid.pdf"
      documentLoadFailed={(args) => {
        console.log(`Load failed. Error: ${args.documentName}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

documentUnload

The documentUnload event triggers when closing the current document.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      documentUnload={() => {
        console.log('Document unloaded');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

downloadEnd

The downloadEnd event triggers after a document download completes.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      downloadEnd={(args) => {
        console.log(`Download finished. File name: ${args.fileName}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

downloadStart

The downloadStart event triggers when the download operation is initiated.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      downloadStart={() => {
        console.log('Download started');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

exportFailed

The exportFailed event triggers when exporting annotations fails.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      exportFailed={(args) => {
        console.log(`Export failed: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

exportStart

The exportStart event triggers when exporting annotations starts.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      exportStart={() => {
        console.log('Export started');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

exportSuccess

The exportSuccess event triggers when annotations are exported successfully.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      exportSuccess={() => {
        console.log('Export success');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

extractTextCompleted

The extractTextCompleted event triggers when text extraction completes.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      extractTextCompleted={(args) => {
        console.log(`Extracted text length: ${(args.documentTextCollection || '').length}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

hyperlinkClick

The hyperlinkClick event triggers when a hyperlink is clicked.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      hyperlinkClick={(args) => {
        console.log(`Hyperlink clicked: ${args.hyperlink}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

hyperlinkMouseOver

The hyperlinkMouseOver event triggers when hovering over a hyperlink.

  • Event arguments: HyperlinkMouseOverArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      hyperlinkMouseOver={(args) => {
        console.log(`Hyperlink hover at page: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

importFailed

The importFailed event triggers when importing annotations fails.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      importFailed={(args) => {
        console.log(`Import failed: ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

importStart

The importStart event triggers when importing annotations starts.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      importStart={() => {
        console.log('Import started');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

importSuccess

The importSuccess event triggers when annotations are imported successfully.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      importSuccess={() => {
        console.log('Import success');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

keyboardCustomCommands

The keyboardCustomCommands event triggers when customized keyboard command keys are pressed.

When it triggers

  • After registering gestures in the commandManager (for example, via commandManager.keyboardCommand). For example, pressing Shift + Alt + G or Shift + Alt + H triggers the event. Use this event to handle custom keyboard shortcuts.

Refer to Keyboard interaction for details about adding and handling custom shortcut keys.
Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);

  const onCreated = React.useCallback(() => {
    if (viewer.current) {
      viewer.current.commandManager = {
        keyboardCommand: [
          { name: 'customCopy', gesture: { pdfKeys: PdfKeys.G, modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt } },
          { name: 'customPaste', gesture: { pdfKeys: PdfKeys.H, modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt } },
          { name: 'customCut', gesture: { pdfKeys: PdfKeys.Z, modifierKeys: ModifierKeys.Control } },
          { name: 'customSelectAll', gesture: { pdfKeys: PdfKeys.E, modifierKeys: ModifierKeys.Control } },
        ],
      };
    }
  }, []);

  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      created={onCreated}
      keyboardCustomCommands={(args) => {
        console.log('Custom command triggered:', args);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

moveSignature

The moveSignature event triggers when a signature is moved across the page.

  • Event arguments: MoveSignatureEventArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      moveSignature={(args) => {
        console.log(`Signature moved on page ${args.id}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageChange

The pageChange event triggers when the current page number changes (for example, via scrolling or navigation controls).

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageChange={(args) => {
        console.log(`Page changed from ${args.previousPageNumber} to ${args.currentPageNumber}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageClick

The pageClick event triggers when a mouse click occurs on a page.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageClick={(args) => {
        console.log(`Page ${args.pageNumber} clicked at (${args.x}, ${args.y})`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageMouseover

The pageMouseover event triggers when the mouse moves over a page.

  • Event arguments: PageMouseoverEventArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageMouseover={(args) => {
        console.log(`Mouse over page ${args.name}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageOrganizerSaveAs

The pageOrganizerSaveAs event triggers when a Save As action is performed in the page organizer.

  • Event arguments: PageOrganizerSaveAsEventArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageOrganizerSaveAs={(args) => {
        console.log(`Page organizer save triggered. File name: ${args.downloadDocument}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageRenderComplete

The pageRenderComplete event triggers after a page finishes rendering.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageRenderComplete={(args) => {
        console.log(`Page ${args.data} rendering completed.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

pageRenderInitiate

The pageRenderInitiate event triggers when page rendering begins.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      pageRenderInitiate={(args) => {
        console.log(`Page ${args.jsonData} rendering initiated.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

printEnd

The printEnd event triggers when a print action completes.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      printEnd={() => {
        console.log('Print action completed.');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

printStart

The printStart event triggers when a print action is initiated.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      printStart={() => {
        console.log('Print action initiated.');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

removeSignature

The removeSignature event triggers when a signature is removed.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      removeSignature={(args) => {
        console.log(`Signature removed from page ${args.bounds}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

resizeSignature

The resizeSignature event triggers when a signature is resized.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      resizeSignature={(args) => {
        console.log(`Signature resized on page ${args.currentPosition}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

resourcesLoaded

The resourcesLoaded event triggers after the viewer’s required resources are loaded.

  • Event arguments: void.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      resourcesLoaded={() => {
        console.log('PDFium resources loaded.');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

signaturePropertiesChange

The signaturePropertiesChange event triggers when signature properties change.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      signaturePropertiesChange={(args) => {
        console.log(`Signature properties changed on page ${args.type}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

signatureSelect

The signatureSelect event triggers when a signature is selected.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      signatureSelect={(args) => {
        console.log(`Signature selected on page ${args.signature}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

signatureUnselect

The signatureUnselect event triggers when a signature is unselected.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      signatureUnselect={(args) => {
        console.log(`Signature unselected ${args.signature}`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

textSearchComplete

The textSearchComplete event triggers when a text search completes.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      textSearchComplete={() => {
        console.log('Text search completed.');
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

textSearchHighlight

The textSearchHighlight event triggers when searched text is highlighted.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      textSearchHighlight={(args) => {
        console.log(`Search result ${args.bounds} highlighted.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

textSearchStart

The textSearchStart event triggers when a text search is initiated.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      textSearchStart={(args) => {
        console.log(`Text search started for: "${args.searchText}"`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

textSelectionEnd

The textSelectionEnd event triggers when text selection is complete.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      textSelectionEnd={(args) => {
        console.log(`Text selection ended on page ${args.pageIndex}.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

textSelectionStart

The textSelectionStart event triggers when text selection is initiated.

  • Event arguments: TextSelectionStartEventArgs.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      textSelectionStart={(args) => {
        console.log(`Text selection started on page ${args.pageIndex}.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

thumbnailClick

The thumbnailClick event triggers when a thumbnail is clicked.

Example:

import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';

function App() {
  const viewer = React.useRef(null);
  return (
    <PdfViewerComponent
      id="pdfViewer"
      ref={viewer}
      documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
      resourceUrl="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
      thumbnailClick={(args) => {
        console.log(`Thumbnail clicked for page index ${args.pageNumber}.`);
      }}
      style=
    >
      <Inject services={[Toolbar, Magnification, Navigation, LinkAnnotation, ThumbnailView, BookmarkView, TextSelection, Annotation, FormDesigner, FormFields, PageOrganizer]} />
    </PdfViewerComponent>
  );
}

const root = ReactDOM.createRoot(document.getElementById('pdfViewer'));
root.render(<App />);

Tip: For annotation and signature-specific events and arguments, see the dedicated Annotations Events topic.

See also: