Increments on every document change; useful as a cache key.
The error thrown by the most recent open attempt, or null.
File associated with an import error, or null for document-open errors.
The operation that produced error.
Decoder used by all built-in image import paths.
Increments when pages are added, removed, rotated or reordered.
The effective default password provider: the app-supplied one, or the batteries-included fallback when none was supplied. Used by every built-in open path and read by callers that open outside the store (e.g. importing pages into the current document).
The searcher for the current viewer, or null before one is attached.
The text currently in the search box.
DOM surface currently hosting the viewer, or null before mount.
The live viewer, or null before PdfViewerSurface has mounted.
Creates the viewer inside element. Called by PdfViewerSurface on
mount. Re-attaching the same element (StrictMode's remount) reuses the
existing viewer instead of rebuilding the worker.
The element value (HTMLElement).
Clears error (e.g. when the user dismisses the error banner). A no-op when there is no error. The next open attempt also clears it.
Tears the viewer down. Called by PdfViewerSurface on unmount.
The latest viewer error, or null when no error is active.
The text searcher for the attached viewer, or null before attachment.
The current text-search query.
Stable snapshot getters, bound for useSyncExternalStore.
The resolved PdfrxViewer or null.
Shows an error from a built-in import action in the viewer app's error banner.
The error value (unknown).
The fileName value (string).
Sets the app's context-menu builder (or null for the localized default).
Read at menu-show time, so no viewer rebuild is needed.
The builder value (PdfReactContextMenuBuilder or null or undefined).
Sets the fallback used only when no app password provider was supplied.
The provider value (PdfPasswordProvider or undefined).
Sets the app-supplied image decoder (from the imageDecoder prop).
The decoder value (PdfImageDecoder or undefined).
Sets the app-supplied default password provider (from the passwordProvider prop).
The provider value (PdfPasswordProvider or undefined).
Sets the search text and starts (or clears) the search.
startTextSearch ignores a pattern identical to the last one, so re-running
the same query needs resetTextSearch() first — force does that for you.
The query value (string).
Optionaloptions: StartTextSearchOptions & { force?: boolean }
Options that customize the operation.
Declares which document should be shown. A no-op when the source is
equivalent to the current one, so passing an inline src string on every
render does not reopen the document.
The src value (PdfSource).
Sets the strings the default context menu is built from. Called by the provider; the menu reads the latest value when it opens, so no viewer rebuild is needed.
The strings value (PdfrxStrings).
Subscribes to viewer/error/document changes. Returns an unsubscribe function.
The callback to invoke when the value changes.
A function that removes the listener.
Merges new option values into the object the viewer reads from. Most options
take effect immediately; engine, engineOptions and initialFit are only
consulted at construction, so changing those requires remounting the
provider.
Options that customize the operation.
Owns one PdfrxViewer instance on behalf of a React tree.
React cannot construct the viewer itself, because
new PdfrxViewer(container)needs a DOM node that only exists once PdfViewerSurface has rendered — which is a descendant of the provider. So the provider creates this store, the surface calls attach with its<div>, and every hook subscribes here. The store is a plain object with no React dependency, which also makes it straightforward to test.Instances are created by
PdfrxProvider; you normally reach one throughusePdfrxStore()rather than constructing it.