From e6d5125dc7ea799c0a34c86d35cde9e74db19423 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Thu, 25 Jun 2026 15:11:17 +0200 Subject: [PATCH 1/2] Allow overriding document options via `options` prop --- src/PDFPreviewer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PDFPreviewer.tsx b/src/PDFPreviewer.tsx index bb3fb11..59debff 100644 --- a/src/PDFPreviewer.tsx +++ b/src/PDFPreviewer.tsx @@ -3,6 +3,7 @@ import type {CSSProperties, ReactNode} from 'react'; import times from 'lodash/times.js'; import {VariableSizeList as List} from 'react-window'; import {Document} from 'react-pdf'; +import type {DocumentProps} from 'react-pdf'; import 'react-pdf/dist/Page/AnnotationLayer.css'; import 'react-pdf/dist/Page/TextLayer.css'; @@ -28,6 +29,7 @@ type Props = { containerStyle?: CSSProperties; contentContainerStyle?: CSSProperties; rotation?: RotationDegrees; + options?: DocumentProps['options']; }; type OnPasswordCallback = (password: string | null) => void; @@ -50,6 +52,7 @@ function PDFPreviewer({ shouldShowErrorComponent = true, onLoadError, rotation = 0, + options = DEFAULT_DOCUMENT_OPTIONS, }: Props): JSX.Element { const [pageViewports, setPageViewports] = useState([]); const [numPages, setNumPages] = useState(0); @@ -252,7 +255,7 @@ function PDFPreviewer({ > Date: Thu, 25 Jun 2026 15:19:21 +0200 Subject: [PATCH 2/2] Update default cMapUrl option --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 52ba7ba..9f32716 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -16,7 +16,7 @@ const LARGE_SCREEN_SIDE_SPACING = 40; * 2. cMapPacked - specifies if the Adobe CMaps are binary packed or not. The default value is `true`. */ const DEFAULT_DOCUMENT_OPTIONS = { - cMapUrl: 'cmaps/', + cMapUrl: '/cmaps/', cMapPacked: true, };