Skip to content

Commit

Permalink
Adds wrapper API for installLoadFontFunction method and new redaction…
Browse files Browse the repository at this point in the history
…s params.
  • Loading branch information
jamie-lemon committed Jan 20, 2025
1 parent 81b1df1 commit 98f6205
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/mupdfjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class StrokeState extends mupdf.StrokeState { }
export class StructuredText extends mupdf.StructuredText { }
export class Text extends mupdf.Text { }

export function installLoadFontFunction(f: (name: string, script: string) => Buffer | null) {
mupdf.installLoadFontFunction(f)
}

export type CreatableAnnotationType =
"Text" |
"FreeText" |
Expand Down Expand Up @@ -924,14 +928,17 @@ export class PDFPage extends mupdf.PDFPage {
return redaction
}

override applyRedactions(blackBoxes: boolean | number = true, imageMethod: number = PDFPage.REDACT_IMAGE_PIXELS) {
override applyRedactions(blackBoxes: boolean | number = true,
imageMethod: number = PDFPage.REDACT_IMAGE_PIXELS,
lineArtMethod: number = PDFPage.REDACT_LINE_ART_REMOVE_IF_COVERED,
textMethod: number = PDFPage.REDACT_TEXT_REMOVE) {
var num: number
if (typeof blackBoxes === "boolean") {
num = blackBoxes ? 1 : 0
} else {
num = blackBoxes
}
super.applyRedactions(num, imageMethod)
super.applyRedactions(num, imageMethod, lineArtMethod, textMethod)
}

override search(needle: string, maxHits: number = 50): Quad[][] {
Expand Down

0 comments on commit 98f6205

Please sign in to comment.