Skip to content

Commit 31fa5c1

Browse files
committed
Add PdfHighlighter.pdfViewerOptions prop
1 parent f492a4d commit 31fa5c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/PdfHighlighter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type {
3030
import { HighlightLayer } from "./HighlightLayer";
3131
import { MouseSelection } from "./MouseSelection";
3232
import { TipContainer } from "./TipContainer";
33+
import type { PDFViewerOptions } from "pdfjs-dist/types/web/pdf_viewer";
3334

3435
export type T_ViewportHighlight<T_HT> = { position: Position } & T_HT;
3536

@@ -75,6 +76,7 @@ interface Props<T_HT> {
7576
transformSelection: () => void,
7677
) => JSX.Element | null;
7778
enableAreaSelection: (event: MouseEvent) => boolean;
79+
pdfViewerOptions?: PDFViewerOptions;
7880
}
7981

8082
const EMPTY_ID = "empty-id";
@@ -159,7 +161,7 @@ export class PdfHighlighter<T_HT extends IHighlight> extends PureComponent<
159161
}
160162

161163
async init() {
162-
const { pdfDocument } = this.props;
164+
const { pdfDocument, pdfViewerOptions } = this.props;
163165
const pdfjs = await import("pdfjs-dist/web/pdf_viewer.mjs");
164166

165167
const eventBus = new pdfjs.EventBus();
@@ -181,6 +183,7 @@ export class PdfHighlighter<T_HT extends IHighlight> extends PureComponent<
181183
textLayerMode: 2,
182184
removePageBorders: true,
183185
linkService: linkService,
186+
...pdfViewerOptions,
184187
});
185188

186189
linkService.setDocument(pdfDocument);

0 commit comments

Comments
 (0)