Extract Pages From Word with NET REST API

This article demonstrates how to Java WordsApi extract specific pages from a DOCX document using the Aspose.Words Cloud Java SDK and save them as a new Word file. For more information about the DOCX format, see the DOCX file info page.

Prerequisite

Steps to Extract Page from Word Document with Java Low Code API

  1. Initialize the WordsApi class object to work with the Word file
  2. Create a request object using the SaveAsRangeOnlineRequest class
  3. Load the source Word file into the request object
  4. Define the start and end identifiers for the range you want to extract
  5. Call the SaveAsRangeOnline() method to extract the defined range
  6. Save the returned Word file that contains only the selected pages

The steps above outline how to extract pages from a Word document with Java Low Code API. Begin by creating a WordsApi instance, then build a SaveAsRangeOnlineRequest with the input file bytes, range start identifier, range end identifier, and the desired output file name. Invoke SaveAsRangeOnline() with this request and write the response stream to a new DOCX file.

Code for Word Page Extractor with Java REST API

The sample code shows how to save pages as DOCX with Java Low Code API. You can specify range identifiers such as page2 (start at page 2), page2:end (end at page 2), document:end (end of the document), or a node path like id0.0.0. These identifiers let you extract any portion of the document and store it in a separate Word file.

If you need to extract metadata from a Word file, see the related article: Extract Metadata from Word Document with Java REST API.

Keywords: extract pages from word with NET REST API; how to save pages as doc with Java Low Code API; how to save pages as docx with Java REST API; how to convert pages to microsoft word with Java Low Code API; extract text from word document with Java REST API.