Function highlightPDF

  • Function to highlight keywords in a PDF document

    Parameters

    • pdfFile: MwFile

      MwFile object representing the PDF file

    • parsedItems: ParsedTextItem[]

      Array of ParsedTextItem objects representing the text items in the PDF

    • keyword: string

      The keyword to highlight in the PDF

    • color: Pick<RGB, "blue" | "green" | "red"> = ...

      Optional RGB color object to specify the highlight color

    Returns Promise<MwFile>

    A Promise that resolves to an MwFile object representing the highlighted PDF

    const highlightedPdf = await highlightPDF(pdfFile, parsedItems, 'keyword', {red: 1, green: 0, blue: 0});