Skip to content

Commit

Permalink
Add PdfHighlighter.pdfViewerOptions prop
Browse files Browse the repository at this point in the history
  • Loading branch information
agentcooper committed Sep 14, 2024
1 parent f492a4d commit 31fa5c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/PdfHighlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type {
import { HighlightLayer } from "./HighlightLayer";
import { MouseSelection } from "./MouseSelection";
import { TipContainer } from "./TipContainer";
import type { PDFViewerOptions } from "pdfjs-dist/types/web/pdf_viewer";

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

Expand Down Expand Up @@ -75,6 +76,7 @@ interface Props<T_HT> {
transformSelection: () => void,
) => JSX.Element | null;
enableAreaSelection: (event: MouseEvent) => boolean;
pdfViewerOptions?: PDFViewerOptions;
}

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

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

const eventBus = new pdfjs.EventBus();
Expand All @@ -181,6 +183,7 @@ export class PdfHighlighter<T_HT extends IHighlight> extends PureComponent<
textLayerMode: 2,
removePageBorders: true,
linkService: linkService,
...pdfViewerOptions,
});

linkService.setDocument(pdfDocument);
Expand Down

0 comments on commit 31fa5c1

Please sign in to comment.