Function pdfSplitPages

  • Split a given PDF file into separate single-page-files.

    Parameters

    • filepath: string

      The path to the PDF file to be split.

    • outputDirpath: string

      The directory where the split PDF pages should be saved.

    Returns Promise<string[]>

    A promise that resolves to an array of filepaths for the split PDF pages.

    Remarks

    This function reads a PDF file from the provided filepath, splits it into separate pages, and saves each page as a separate PDF file in the specified output directory. The filenames of the output files are zero-padded based on the total number of pages in the original document.

    Throws

    Will throw an error if the input file cannot be read or the output directory cannot be created.

    Example

    const inputFilePath = '/path/to/input.pdf';
    const outputDirPath = '/path/to/output/directory';
    pdfSplitPages(inputFilePath, outputDirPath)
    .then(filepaths => console.log(filepaths))
    .catch(error => console.error(error));

Generated using TypeDoc