pdfrx_web
    Preparing search index...

    Module @pdfrx/react

    React bindings for the pdfrx canvas-based PDF viewer.

    Three layers, pick the one that fits:

    1. All-in-onePdfrxViewerApp is the whole thing: toolbar, sidebar with thumbnails and outline, search, print. One component, one src prop.
    2. Composable partsPdfrxProvider plus PdfViewerSurface, PdfToolbar, PdfSidebar, PdfSearchBox and friends, arranged however your layout needs. Import @pdfrx/react/styles.css for their default look.
    3. HeadlessPdfrxProvider plus the hooks (usePdfSearch, usePdfOutline, usePdfPageThumbnail, …) with UI entirely your own.

    All three need the engine's WASM assets: point wasmModulesUrl at a directory holding pdfium_worker.js and pdfium.wasm (copy them from node_modules/@pdfrx/engine/assets/, or use the jsDelivr CDN).

    import { PdfrxViewerApp } from '@pdfrx/react';
    import '@pdfrx/react/styles.css';

    <PdfrxViewerApp src="/manual.pdf" wasmModulesUrl="/pdfium/" style={{ height: '100vh' }} />
    <PdfrxProvider src="/manual.pdf" wasmModulesUrl="/pdfium/">
    <PdfToolbar />
    <div style={{ display: 'flex', flex: 1, minHeight: 0 }}>
    <PdfSidebar />
    <PdfViewerSurface style={{ flex: 1 }} />
    </div>
    </PdfrxProvider>

    @pdfrx/react

    React components and hooks for the pdfrx_web canvas viewer. Start with the all-in-one PdfrxViewerApp, compose the supplied UI pieces, or build custom UI with headless hooks.

    npm package · Live demo · API reference · Detailed guide

    • The all-in-one viewer includes toolbar, responsive thumbnails/outline sidebar, search, forms, annotations, page editing, print, and download.
    • The same functionality is available as composable components and headless hooks, so applications can own as much of the UI as they need.
    • Annotation, form, and page changes share one chronological Undo/Redo history.
    • PDF and image opening, thumbnail insertion/reordering, and image annotation drops are supported by the standard UI.
    • Two-page book layouts, rectangular image capture, marquee zoom, and browser fullscreen are available as composed controls; the all-in-one app keeps the specialized layout/capture tools and printing hidden until explicitly enabled.
    • Declarative feature groups and effective PDF permissions consistently hide or disable standard print, page-editing, annotation, and form entry points.
    • English, Japanese, Simplified and Traditional Chinese, French, and German are built in, with string overrides for additional locales.
    • CSS custom properties provide theming and responsive behavior; server rendering and React StrictMode are supported.
    • Application overrides can retain the standard chrome while replacing open, page mutation, and export operations.
    npm install @pdfrx/react react react-dom
    
    import { PdfrxViewerApp } from '@pdfrx/react';
    import '@pdfrx/react/styles.css';

    export function App() {
    return (
    <PdfrxViewerApp
    src="/manual.pdf"
    wasmModulesUrl="/pdfium/"
    style={{ height: '100dvh' }}
    />
    );
    }

    Copy pdfium_worker.js and pdfium.wasm from node_modules/@pdfrx/engine/assets/ into the public /pdfium/ directory. Remote PDF URLs must allow browser CORS access.

    Browser printing is supported on desktop platforms. On iOS/iPadOS the standard print button is omitted because WebKit cannot reliably isolate PDF pages from the surrounding viewer UI; use the save/download action instead.

    The canvas background and the all-in-one app background are separate layers. To reveal the embedding application's background through PdfrxViewerApp, make both transparent:

    <PdfrxViewerApp
    src="/manual.pdf"
    wasmModulesUrl="/pdfium/"
    backgroundColor="transparent"
    style={{ height: '100dvh', background: 'transparent' }}
    />

    backgroundColor="transparent" clears the viewer canvas around PDF pages. The inline background override removes the default var(--pdfrx-bg) fill on the .pdfrx-app wrapper; omitting it reveals that themed wrapper background, not the application behind it.

    MIT

    PdfrxViewerStore
    ThumbnailCache
    AnnotationStyle
    ContextMenuContext
    ImageAnnotationDropHandlers
    Offset
    PdfAnnotationsState
    PdfAnnotationToolbarProps
    PdfCaptureAreaButtonProps
    PdfContextMenuHelpers
    PdfControlProps
    PdfDocument
    PdfDocumentState
    PdfEditHistory
    PdfFormFieldsState
    PdfFullscreen
    PdfFullscreenButtonProps
    PdfLoadingProgress
    PdfNavigation
    PdfOutlineNode
    PdfOutlineState
    PdfOutlineTreeProps
    PdfPage
    PdfPageActionsProps
    PdfPageArrangementEntry
    PdfPageMutationOptions
    PdfPageThumbnail
    PdfPoint
    PdfPrint
    PdfRect
    PdfrxPageMutationOptions
    PdfrxProviderProps
    PdfrxStrings
    PdfrxViewer
    PdfrxViewerAppOverrides
    PdfrxViewerAppProps
    PdfrxViewerAppRenderContext
    PdfrxViewerOptions
    PdfSaveButtonProps
    PdfSearch
    PdfSearchBoxProps
    PdfSelectedTextRange
    PdfSelection
    PdfSidebarProps
    PdfTextSelectionRange
    PdfThumbnailListProps
    PdfToolbarProps
    PdfViewerLayoutControls
    PdfViewerLayoutProps
    PdfViewerSurfaceProps
    PdfZoom
    SearchMatch
    StartTextSearchOptions
    UseImageAnnotationDropOptions
    ViewTransform
    AnnotationTool
    ContextMenuBuilder
    FitMode
    LayoutDirection
    NormalizedPdfSource
    PanAxis
    PdfDest
    PdfPageChangeListener
    PdfPageChangeOrigin
    PdfPageRotationDelta
    PdfPasswordProvider
    PdfReactContextMenuBuilder
    PdfrxLocale
    PdfrxViewerFeature
    PdfrxViewerFeatures
    PdfSidebarTab
    PdfSource
    ViewerSubscribe
    builtinPdfrxLocales
    builtinPdfrxStrings
    defaultPdfrxStrings
    TEXT_HIGHLIGHT_COLORS
    TEXT_HIGHLIGHT_OPACITY
    TEXT_MARKUP_LINE_COLORS
    buildDefaultContextMenu
    IconAnnotate
    IconOpenFile
    imageBytesToPdf
    isImageFile
    isPdfFile
    looksLikePdf
    normalizeSource
    openFileAsDocument
    PdfAnnotationToolbar
    PdfCaptureAreaButton
    PdfFullscreenButton
    PdfLoadingBar
    PdfMarqueeZoomButton
    PdfOutlineTree
    PdfPageActions
    PdfPageIndicator
    PdfPrintButton
    PdfrxProvider
    PdfrxViewerApp
    PdfSaveButton
    PdfSearchBox
    PdfSidebar
    PdfSpreadButton
    PdfThumbnailList
    PdfToolbar
    PdfViewerLayout
    PdfViewerSurface
    PdfZoomControls
    resolvePdfrxStrings
    shallowEqual
    useAnnotations
    useDocumentGeneration
    useEditHistory
    useFormFields
    useImageAnnotationDrop
    useOptionalPdfrxStore
    usePdfDocument
    usePdfFullscreen
    usePdfNavigation
    usePdfOutline
    usePdfPageChanges
    usePdfPagesRevision
    usePdfPageThumbnail
    usePdfPrint
    usePdfrxStore
    usePdfrxStrings
    usePdfrxViewer
    usePdfSearch
    usePdfSelection
    usePdfZoom
    useViewerSnapshot