Split PDF via Aspose.PDF for Node.js via C++

Files splitting with the help of Aspose.PDF for Node.js via C++ Tool.

Split Files Using Aspose.PDF for Node.js via C++

Need just part of your large files? To separate one or more parts from your document, you must split the pages of the original file. In order to split files, we’ll use Aspose.PDF for Node.js via C++ extract files from the ZIP archive.

Split documents via JavaScript


You need Aspose.PDF for Node.js via C++ to try the code in your environment.

  1. Load the PDF with an instance of Document.
  2. Create a new Document class object to split PDF pages.
  3. Add current page to the document.
  4. Save current page as a separate PDF

How to split PDF using JavaScript

With the Aspose.PDF library, you can split large PDF documents. Splitting a PDF document is a common use case when working with PDF documents. It helps reduce the size of a PDF file by breaking large documents into smaller files to send via email.

Split PDF - JavaScript

This sample code shows how to split PDF file - JavaScript

const AsposePdf = require('../AsposePDFforNode.js');
const pdf_file = '../ReadMe.pdf';
AsposePdf().then(AsposePdfModule => {
    /*Set number a page to split*/
    const pageToSplit = 1;
    /*Split to two PDF-files and save the "ResultSplit1.pdf", "ResultSplit2.pdf"*/
    const json = AsposePdfModule.AsposePdfSplit2Files(pdf_file, pageToSplit, "./ResultSplit1.pdf", "./ResultSplit2.pdf");
    console.log("AsposePdfSplit2Files => %O", json.errorCode == 0 ? [json.fileNameResult1, json.fileNameResult2] : json.errorText);
});