Function pdfExtractRanges

  • Function to split a PDF file by page ranges and merge them into a new MwFile

    Parameters

    • mwFile: MwFile

      MwFile object

    • ranges: PageRange[]

      An array of page ranges to extract, each range is an array with two numbers: the start and end page numbers

    Returns Promise<MwFile>

    An MwFile object with only the extracted page ranges from the original file

    const mwFile = convertBase64ToFile(examplePdfBase64);
    const ranges = [[0, 2], [4, 5], [7, 8]];
    const newMwFile = await pdfExtractRanges(mwFile, ranges);