How to Split PowerPoint PPTX Slides using REST API in Ruby

How to Split PowerPoint PPTX Slides using REST API in Ruby

While creating and manipulating PowerPoint PPT or PPTX presentations programmatically, you may need to split a lengthy PowerPoint document and save it as separate PowerPoint files. It will be time consuming task if you manually split a large PowerPoint document into presentations with original slide. In this article, we will introduce a simple solution about how to split PowerPoint PPT or PPTX Presentations in Ruby.

The following topics shall be covered in this article:

PowerPoint PPTX Splitter Cloud API and Ruby SDK

For splitting PowerPoint PPTX/PPT Slides, I will be using the Ruby SDK of GroupDocs.Merger Cloud API. It allows you to split, combine, remove and rearrange a single page or a collection of pages from supported document formats of Word, Excel, Visio drawings, PDF, and HTML.

You can install and download powerpoint splitter to your Ruby application using the following command in the terminal:

gem install groupdocs_conversion_cloud

Please get your Client ID and Secret from the dashboard before following the below mentioned steps. Once you have your ID and Secret, add the below code into your application to split powerpoint into two files as shown below:

Split PPTX to Single Slide Files using REST API in Ruby

You can split PowerPoint PPT/PPTX slides programmatically on the cloud by following the simple steps mentioned below. Follow the instructions to Upload the PPTX file and then download file from the cloud using REST API. You can split pages of any PPTX file into separate PowerPoint slides programmatically by following the steps given below:

  • Firstly, create an instance of the DocumentApi.
  • Then, create an instance of the SplitOptions.
  • Now, create an instance of the FileInfo.
  • Next, set path to the input PowerPoint file.
  • Then, assign FileInfo to the split options.
  • Provide output path and specific page numbers in a comma separated array to split document.
  • Now, set document split mode to Pages. It allows API to split page numbers given in comma separated array as a separate PowerPoint slides.
  • Create SplitRequest with SplitOptions.
  • Finally, call the DocumentAPI.split() method with SplitRequest and get results.

The following code snippet shows how to split PowerPoint file using REST API in Ruby:

The above code sample will save the separated single files .

Separate PowerPoint PPTX into Multiple Slides in Ruby

You can split PowerPoint files into multipage PowerPoint slides programmatically by following the steps given below:

  • Create an instance of the DocumentApi.
  • Now, create an instance of the SplitOptions.
  • Next, create an instance of the FileInfo.
  • Next, set path to the input PPTX file.
  • Then, assign FileInfo to the SplitOptions.
  • Set output path and specific page numbers in a comma separated array to split document.
  • Now, set document split mode to Intervals.
  • Create SplitRequest with SplitOptions.
  • Finally, call the DocumentAPI.split() method with SplitRequest and get results.

The following code snippet shows how to split PowerPoint file into multi-page PowerPoint slides using REST API in Ruby:

Break PowerPoint PPTX by Slide Number in Ruby

You can extract and save pages from a PowerPoint file by providing a range of page numbers programmatically by following the steps given below:

  • First, create an instance of the DocumentApi.
  • Then, create an instance of the SplitOptions.
  • Now, create an instance of the FileInfo.
  • Next, set path to the input PPTX file.
  • Then, assign FileInfo to the SplitOptions.
  • Set output path, start_page_number and end_page_number to split document.
  • Now, set document split mode to pages.
  • Create SplitRequest with SplitOptions.
  • Finally, call the DocumentAPI.split() method with SplitRequest and get results.

The following code snippet shows how to split PowerPoint file by exact page numbers in Ruby using REST API:

Split PowerPoint PPTX by Slides Range Mode in Ruby

You can separate pages from a PPTX file by providing a range of page numbers programmatically by following the steps given below:

  • First, create an instance of the DocumentApi.
  • Then, create an instance of the SplitOptions.
  • Now, create an instance of the FileInfo.
  • Next, set path to the input PowerPoint slides file.
  • Then, assign FileInfo to the SplitOptions.
  • Set output path, start_page_number and end_page_number to split document.
  • Now, set document range_mode to OddPages and split mode to Intervals.
  • Create SplitRequest with SplitOptions.
  • Finally, call the DocumentAPI.split() method with SplitRequest and get results.

The following code snippet shows how to split slides file by applying filter using REST API in Ruby:

Online Split PowerPoint File

How to Split PowerPoint File Online? Using free online PPTX Splitter, you can split PowerPoint document into multiple PPTX slides by a fixed number of pages or in various page ranges. Multiple pages PPTX documents are divided into multiple PPTX files keeping the layout of the source document.

Conclusion

In this tutorial, we have learned:

  • how to split file PPTX using REST API in Ruby on the cloud;
  • how to split PPTX into multiple slides file programmatically;
  • extract PPTX slides by exact number using Ruby;
  • separate slides by slides range mode in Ruby;

Moreover, you can learn more about GroupDocs.Merger Cloud API using the documentation. We also provide an API Reference section that lets you visualize and communicate with our APIs directly through the browser.

Ask a question

If you have any questions abouthow to split ppt into multiple files online or extract pages from ppt, please feel free to ask us on the Forum

See Also