├── .gitignore ├── assets └── screenshot.png ├── prettier.config.js ├── display-reading-progress-at-the-top ├── StoreProps.ts ├── README.md ├── readingIndicatorPlugin.tsx ├── ReadingProgressExample.tsx └── ReadingIndicator.tsx ├── open-a-confirmation-modal-when-users-click-a-link ├── StoreProps.ts ├── OpenConfirmationModalExample.tsx ├── openLinksPlugin.tsx └── ConfirmationModal.tsx ├── slide-presentation ├── README.md └── disableScrollPlugin.tsx ├── highlight-keywords-programmatically ├── screenshot.png └── README.md ├── add-custom-styles-to-the-highlighted-elements ├── screenshot.png ├── README.md └── CustomHighlightedElementExample.tsx ├── keep-scroll-position-after-changing-the-document ├── StoreProps.ts ├── isDocumentChangedPlugin.tsx ├── KeepScrollOffsetExample.tsx ├── trackPositionPlugin.tsx └── PositionTracker.tsx ├── zoom-to-a-specific-level-programmatically ├── StoreProps.tsx └── customZoomPlugin.tsx ├── hide-unnecessary-elements-when-printing-a-document └── modalExample.css ├── zoom-after-full-screen ├── StoreProps.ts ├── zoomAfterFullScreen.tsx ├── ZoomAfterFullScreenExample.tsx └── Tracker.tsx ├── README.md ├── use-multiple-viewers-in-the-same-page ├── MultipleViewersSamePageExample.tsx └── ViewerWrapper.tsx ├── drop └── DropExample.tsx ├── disable-scroll └── DisableScrollExample.tsx ├── initial-page └── InitialPageExample.tsx ├── customize-thumbnail-spinners ├── square-spinner.css └── CustomThumbnailSpinnerExample.tsx ├── keep-scale-level-after-changing-the-document ├── trackScalePlugin.tsx └── KeepScaleLevelExample.tsx ├── set-the-initial-tab-in-the-default-layout ├── SetInitialTabExample.tsx └── SetInitialTabPageModeExample.tsx ├── submit-the-password-programmatically └── SubmitPasswordExample.tsx ├── theme ├── DarkThemeExample.tsx ├── AutoSwitchThemeExample.tsx └── SwitchThemeButtonExample.tsx ├── customize-loader-renderer └── RenderLoaderExample.tsx ├── default-layout ├── DefaultLayoutExample.tsx ├── OpenSidebarTabExample.tsx ├── RenderToolbarExample.tsx └── ToolbarSlotsExample.tsx ├── find-and-replace-links-found-in-each-page ├── FindLinksExample.tsx └── findLinksPlugin.ts ├── singe-page-view └── SinglePageViewExample.tsx ├── display-the-thumbnail-of-a-given-page ├── pageThumbnailPlugin.tsx └── DisplayThumbnailExample.tsx ├── remove-all-tabs-from-the-sidebar └── RemoveAllTabsExample.tsx ├── search-sidebar-with-initial-keyword ├── SearchSidebar.tsx └── SearchSidebarInitialKeywordExample.tsx ├── disable-text-selection └── DisableTextSelectionExample.tsx ├── set-the-page-from-last-visit-as-the-initial-page └── StoreCurrentPageExample.tsx ├── character-map └── CharacterMapExample.tsx ├── customize-the-width-of-thumbnails ├── CustomWidthDefaultLayoutExample.tsx └── CustomWidthExample.tsx ├── jump-to-given-page ├── jumpToPagePlugin.tsx └── JumpToGivenPageExample.tsx ├── localization └── LocalizationExample.tsx ├── add-margin-between-pages └── AddMarginExample.tsx ├── remove-a-tab-from-the-sidebar └── RemoveTabExample.tsx ├── change-the-order-of-tabs-in-the-sidebar └── ChangeTabsOrderExample.tsx ├── events └── EventsExample.tsx ├── set-the-target-pages-when-printing-a-document ├── SetPagesDefaultLayoutExample.tsx └── SetPagesExample.tsx ├── use-a-rtl-language └── RtlExample.tsx ├── use-the-last-chosen-theme └── UseLastThemeExample.tsx ├── replace-the-canvas-with-svg-layer └── SvgLayerExample.tsx ├── include-the-default-sidebar-in-the-full-screen-mode └── IncludeSidebarFullScreenModeDefaultLayoutExample.tsx ├── include-the-default-toolbar-in-the-full-screen-mode ├── IncludeToolbarFullScreenModeDefaultLayoutExample.tsx └── IncludeToolbarFullScreenModeExample.tsx ├── zoom-to-fit-the-screen-after-entering-the-full-screen-mode └── ZoomToFitScreenInFullScreenModeExample.tsx ├── add-a-new-tab-to-the-sidebar └── AddNewTabExample.tsx ├── bookmark └── BookmarkExample.tsx ├── thumbnail └── ThumbnailExample.tsx ├── attachment └── AttachmentExample.tsx ├── jump-to-the-first-match-of-pre-defined-keywords-automatically └── JumpToFirstMatchExample.tsx ├── show-search-results-in-a-sidebar └── SearchSidebarExample.tsx ├── customize-the-button-to-exit-the-full-screen-mode └── CustomExitFullScreenButtonExample.tsx ├── customize-the-zoom-levels ├── CustomizeZoomLevelsDefaultLayoutExample.tsx └── CustomizeZoomLevelsExample.tsx ├── set-a-bookmark-expanded-or-collapsed-initially └── SetBookmarkExpandedExample.tsx ├── switch-to-a-scroll-mode └── SwitchScrollModeInFullScreenModeExample.tsx ├── get-file ├── DownloadButtonExample.tsx ├── CustomizeFileNameExample.tsx └── CustomizeDownloadButtonExample.tsx ├── open ├── OpenButtonExample.tsx └── CustomizeOpenButtonExample.tsx ├── draw-on-top-of-the-canvas-layer └── DrawCanvasExample.tsx ├── remove-some-parts-from-the-default-toolbar ├── RemovePartsDefaultToolbarDefaultLayoutExample.tsx └── RemovePartsDefaultToolbarExample.tsx ├── print ├── PrintButtonExample.tsx └── CustomizePrintButtonExample.tsx ├── toolbar ├── DefaultToolbarExample.tsx └── ToolbarOptionsExample.tsx ├── add-a-watermark └── WaterMarkExample.tsx ├── customize-link-annotation └── CustomLinkAnnotationExample.tsx ├── full-screen ├── FullScreenButtonExample.tsx └── CustomizeFullScreenButtonExample.tsx ├── package.json ├── search ├── ShowSearchPopoverButtonExample.tsx ├── HighlightMultipleKeywordsExample.tsx └── CustomizeSearchPopoverButtonExample.tsx ├── preview-a-pdf-file-before-uploading └── PreviewLocalFile.tsx ├── properties ├── ShowPropertiesButtonExample.tsx └── CustomizePropertiesButtonExample.tsx ├── show-custom-page-labels-for-thumbnails └── CustomLabelExample.tsx ├── rotate ├── RotateButtonsExample.tsx └── CustomizeRotateButtonsExample.tsx ├── customize-error-renderer └── RenderErrorExample.tsx ├── render-the-highlight-areas └── RenderHighlightAreasExample.tsx ├── page-navigation ├── CurrentPageExample.tsx └── PageNavigationButtonsExample.tsx ├── highlight └── RenderHighlightTargetExample.tsx ├── print-the-current-document-programmatically └── PrintDocumentExample.tsx ├── zoom └── ZoomButtonsExample.tsx ├── customize-bookmark-items ├── CustomizeToggleIconsDefaultLayoutExample.tsx └── CustomizeToggleIconsExample.tsx ├── selection-mode └── SwitchSelectionModeButtonsExample.tsx ├── preview-a-pdf-file-from-base-64 └── LoadFromBase64Example.tsx ├── customize-the-default-toolbar └── CustomizeDefaultToolbarExample.tsx ├── show-the-custom-page-label-for-the-current-page └── CurrentPageLabelExample.tsx ├── execute-a-function-when-users-click-a-bookmark-item └── ClickBookmarkItemExample.tsx ├── customize-the-protected-view └── CustomizeProtectedViewExample.tsx ├── use-a-different-language ├── LocalizationExample.tsx ├── vi_VN.json └── en_US.json ├── use-the-rotate-page-component-to-rotate-a-particular-page ├── RotatePageExample.tsx └── RotatePageWithThumbnailsExample.tsx ├── customize-the-progress-bar-when-preparing-pages-to-print ├── CustomizeProgressBarDefaultLayoutExample.tsx └── CustomizeProgressBarExample.tsx ├── add-buttons-to-each-page-for-rotating-the-target-page └── RotateSinglePageExample.tsx ├── preview-a-document-inside-a-modal └── ModalExample.tsx ├── scroll-mode └── SwitchScrollModeButtonsExample.tsx ├── magazine └── MagazineExample.tsx └── locale-switcher └── vi_VN.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-pdf-viewer/examples/HEAD/assets/screenshot.png -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, 3 | singleQuote: true, 4 | tabWidth: 4, 5 | }; 6 | -------------------------------------------------------------------------------- /display-reading-progress-at-the-top/StoreProps.ts: -------------------------------------------------------------------------------- 1 | export default interface StoreProps { 2 | getPagesContainer?(): HTMLElement; 3 | } 4 | -------------------------------------------------------------------------------- /open-a-confirmation-modal-when-users-click-a-link/StoreProps.ts: -------------------------------------------------------------------------------- 1 | export default interface StoreProps { 2 | clickedTarget?: string; 3 | } 4 | -------------------------------------------------------------------------------- /slide-presentation/README.md: -------------------------------------------------------------------------------- 1 | ## Example: Slide presentation 2 | 3 | [Live demo](https://react-pdf-viewer.dev/examples/slide-presentation) 4 | -------------------------------------------------------------------------------- /highlight-keywords-programmatically/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-pdf-viewer/examples/HEAD/highlight-keywords-programmatically/screenshot.png -------------------------------------------------------------------------------- /add-custom-styles-to-the-highlighted-elements/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-pdf-viewer/examples/HEAD/add-custom-styles-to-the-highlighted-elements/screenshot.png -------------------------------------------------------------------------------- /display-reading-progress-at-the-top/README.md: -------------------------------------------------------------------------------- 1 | ## Example: Display reading progress at the top 2 | 3 | [Live demo](https://react-pdf-viewer.dev/examples/display-reading-progress-at-the-top) 4 | -------------------------------------------------------------------------------- /keep-scroll-position-after-changing-the-document/StoreProps.ts: -------------------------------------------------------------------------------- 1 | import { Offset } from '@react-pdf-viewer/core'; 2 | 3 | export interface StoreProps { 4 | getPagesContainer?(): HTMLElement; 5 | offset?: Offset; 6 | } 7 | -------------------------------------------------------------------------------- /zoom-to-a-specific-level-programmatically/StoreProps.tsx: -------------------------------------------------------------------------------- 1 | import { SpecialZoomLevel } from '@react-pdf-viewer/core'; 2 | 3 | export default interface StoreProps { 4 | zoom?(scale: number | SpecialZoomLevel): void; 5 | } 6 | -------------------------------------------------------------------------------- /hide-unnecessary-elements-when-printing-a-document/modalExample.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | .rpv-print__body-printing .example-modal { 3 | display: none; 4 | } 5 | } 6 | 7 | .example-modal { 8 | display: flex; 9 | } 10 | -------------------------------------------------------------------------------- /zoom-after-full-screen/StoreProps.ts: -------------------------------------------------------------------------------- 1 | import { SpecialZoomLevel } from '@react-pdf-viewer/core'; 2 | 3 | export default interface StoreProps { 4 | getPagesContainer?(): HTMLElement; 5 | zoom?(scale: number | SpecialZoomLevel): void; 6 | } 7 | -------------------------------------------------------------------------------- /highlight-keywords-programmatically/README.md: -------------------------------------------------------------------------------- 1 | ## Example: Highlight keywords programmatically 2 | 3 | [Live demo](https://react-pdf-viewer.dev/examples/highlight-keywords-programmatically) 4 | 5 |  6 | -------------------------------------------------------------------------------- /add-custom-styles-to-the-highlighted-elements/README.md: -------------------------------------------------------------------------------- 1 | ## Example: Add custom styles to the highlighted elements 2 | 3 | [Live demo](https://react-pdf-viewer.dev/examples/add-custom-styles-to-the-highlighted-elements) 4 | 5 |  6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React PDF Viewer examples 2 | 3 | This repository contains the sources of all React PDF Viewer [examples](https://react-pdf-viewer.dev/examples). 4 | 5 |  6 | 7 | These examples work with 8 | 9 | * `@react-pdf-viewer` 3.11.0 10 | * `pdfjs-dist` 3.2.146 -------------------------------------------------------------------------------- /use-multiple-viewers-in-the-same-page/MultipleViewersSamePageExample.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import ViewerWrapper from './ViewerWrapper'; 3 | 4 | const MultipleViewersSamePageExample = () => { 5 | return ( 6 |