You may need to extract a set of consecutive pages from Word documents or may need to split word to individual pages as smaller parts. As a Ruby developer, you can easily extract certain pages from word documents by applying page number filters programmatically. In this article, you will learn how to extract pages from word documents using REST API in Ruby.
The following topics shall be covered to convert word file to separate pages in this tutorial:
- Word Document Extraction REST API and Ruby SDK
- Extract Specific Pages from Word using REST API in Ruby
- Extract Pages from Word File by Range Mode in Ruby
- Online Extract Word Pages For Free
Word Document Extraction REST API and Ruby SDK
To split word to individual pages, we will use word document extractor free download Ruby SDK of GroupDocs.Merger. It is a feature-rich and high-performance Cloud SDK used to save one page or specific pages of a word into a single file. It also allows to extract pages from word into multiple files. This SDK offers additional features to swap, move, remove, rotate or change the page orientation for a whole or preferred range of pages. Moreover, you can perform other manipulations easily for any supported file formats such as PDF, Powerpoint, and Excel worksheets. It supports .NET, Java, PHP, Python, Android, and Node.js SDKs as its document merger family members.
You can install GroupDocs.Merger cloud to select pages from word in Ruby application using the following command in the rails console:
gem install groupdocs_merger_cloud
Please get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Once you have your ID and secret, add in the code as demonstrated below to split docx file into pages:
Extract Specific Pages from Word using REST API in Ruby
You can save specific pages of word by page numbers from the uploaded word file. You can upload the word document to the cloud by following the steps and the word file will be available in the files section of your dashboard. Please follow the steps mentioned below to save certain pages of word document programmatically.
- Firstly, Create an instance PagesApi
- Then, create ExtractOptions instance
- Next, create an instance of FileInfo
- Set the input file path and output file path
- Provide comma separated pages collection to be extracted
- Next, create an instance of ExtractRequest
- Finally, extract word pages by calling the PagesApi.extract() method with ExtractRequest
The following code example shows how to extract files by providing specific page numbers from a word document using REST API:
The above code sample will save the extracted pages in a separate word file on the cloud.
Extract Pages from Word File by Range Mode in Ruby
Please follow the steps mentioned below to extract documents from word by providing range mode programmatically.
- Firstly, Create an instance PagesApi
- Then, create ExtractOptions instance
- Next, create an instance of FileInfo
- Set the input file path and output document path
- Provide _start_page_number _and _end_page_number _options
- Set _range_mode _to EvenPages
- Next, create an instance of ExtractRequest
- Finally, extract word pages by calling the PagesApi.extract() method with ExtractRequest
The following code example shows to split pages in word by providing a page range from a word document using a REST API:
Now, you know how to split or extract word file by providing pages collection or page range mode using Rest API.
Online Extract Word Pages For Free
How to extract pages from word for free? Split or extract word pages online with easy to use free online extract word pages tool. Separating word pages is absolutely secure using free word splitter.
Summing up
In this article, we have learned how to:
- export certain pages from a word document on the cloud using Ruby
- how to programmatically split word to pages by range mode using Ruby
Now you know how to export a single page from a word or how to extract multiple pages from word files fast and secure. You can learn more about GroupDocs.Merger Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser.
Ask a question
If you have any questions about how to extract single page from word or how to split word into multiple pages by range mode, please feel free to ask us on the Forum