Split documents into parts using JavaScript

Node SDK to split several documents and export the result to almost any office format

Use Node library to split Word, PDF, Web documents via REST API. Easily split two or more documents into parts using JavaScript.

View code snippet

Split documents using REST API in JavaScript

This JavaScript library provides Node developers with the ability to work with a document split function using REST API. It allows you to split one document into several smaller files online in JavaScript. For example, you may need to email a few pages from your document, or you may want to show a customer only a part of your file. All this can be done through the document split functionality in JavaScript code.

Various methods can be used for document splitting: 'by page', 'by page ranges', 'by headings', 'by section break'. Just load the original document and choose the method you need. Make sure your document uses the required heading styles or contains section breaks if you want to split your file according to these criteria using JavaScript code. After splitting a document you can export the result as separate document pages or smaller files.

Split a document into parts using Node Cloud SDK

All document splitting is performed in the Cloud on Aspose web servers with maximum speed and in compliance with all security standards. Our JavaScript library is designed to create document-processing applications and is based on client-server interaction via REST API.

Split Word, PDF, HTML, EPUB documents using different criteria with our Cloud SDK for Node. If you have questions on how to split a document into multiple files or how to extract pages according to specified parameters, try our Splitter online and export the result into a convenient document format:

Upload files you want to split
Run code
Select the target format from the list
import * as fs from "fs";

const wordsApi = new WordsApi("####-####-####-####-####", "##################");

const doc = fs.createReadStream("Input.docx");
const request = new model.SplitDocumentOnlineRequest({
    document: doc,
    format: "docx",
    zipOutput: true
});

const zippedPages = wordsApi.splitDocumentOnline(request)
.then((splitDocumentResult) => {
    console.log("Result of SplitDocumentOnline: ", splitDocumentResult);
});
Run code
  
Copy JavaScript code to the clipboard

How to split a document JavaScript REST API: Word, PDF, JPG

  1. Install Node SDK and add the reference (import the library) to your Node project.
  2. Configure API using your app keys
  3. Open the source file in JavaScript using REST API.
  4. Call the splitDocumentOnline() method, passing the output filename with the required extension.
  5. Get the split result as separate files.

Node library to split files

Install 'Aspose.Words Cloud SDK for Node.js' using NPM package manager. Run npm install asposewordscloud --save from the command line to install the SDK via the NPM package manager. As an alternative, you can manually clone Aspose.Words Cloud SDK for Node.js source code from GitHub and use it in your project. Please follow these Instructions to quickly get the necessary security credentials and access our REST API.

System Requirements

  • @types/request (version 2.48.3+)
  • lodash (version 4.17.15+)
  • lodash.template (version 4.5.0+)
  • request (version 2.88.0+)
  • request-debug (version 0.2.0+)

Refer to the Repository Documentation to see more details.

The most popular file formats for splitting

5%

Subscribe to Aspose Product Updates

Get monthly newsletters and offers directly delivered to your mailbox.

© Aspose Pty Ltd 2001-2024. All Rights Reserved.