Function compressPdf

  • Compresses each page of a provided PDF buffer.

    Parameters

    • pdfData: Buffer

      The input PDF as a Buffer.

    • imageQuality: number = 85

      Compression quality (70-100 for most JPG images).

    • forceSourceTextCompression: boolean = false

      If true, attempts to re-write detected text.

    • disableSourceText: boolean = true

      If true, doesn't re-apply source text to the output PDF.

    Returns Promise<Buffer>

    A Promise resolving to the compressed PDF as a Buffer.