Split a Presentation Saved to a Local File Introduction
The article shows you how to split a PowerPoint presentation stored in a local file and receive splitted parts.
API
Type
Description
Resource
/slides/split/{format}
POST
Splits a presentation file stored in a local file and returns the result.
SplitOnline
Request Parameters
Name
Type
Location
Required
Description
document
file
formData
true
The presentation file.
format
string
path
true
The format for output files. See the table for available formats. The default value is jpeg
.
width
integer
query
false
The width of each slide in the output files. Does not affect the HTML format.
height
integer
query
false
The height of each slide in the output files. Does not affect the HTML format.
from
integer
query
false
The 1-based starting slide number for the splitting. If it is not specified, the splitting starts from the first slide of the presentation.
to
integer
query
false
The 1-based last slide number for the splitting. If it is not specified, the splitting ends at the last slide of the presentation.
password
string
header
false
The password to open the presentation.
storage
string
query
false
The name of the storage where the presentation is saved. If it is not specified, the default storage is assumed.
fontsFolder
string
query
false
The path to the storage folder containing custom fonts that can be used in the presentation.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
The SplitOnline
method returns the output files as a ZIP archive.
Splitting a Range of Slides
Split the 2nd and 3rd slides from MyPresentation.pptx file and receive the output slides in PDF format.
cURL Solution
SDK Solutions
C#
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-dotnet
using Aspose.Slides.Cloud.Sdk ;
using Aspose.Slides.Cloud.Sdk.Model ;
using System.IO ;
class Application
{
static void Main ( string [] args )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
// Split the 2nd and 3rd slides and save them to PDF documents.
using var presentationStream = File . OpenRead ( "MyPresentation.pptx" );
using var responseStream = api . SplitOnline ( presentationStream , SlideExportFormat . Pdf , from : 2 , to : 3 );
// Save the output stream to a ZIP file.
using var outputStream = File . Create ( "output.zip" );
responseStream . CopyTo ( outputStream );
}
}
Java
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-java
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.SlideExportFormat ;
import java.io.IOException ;
import java.nio.file.Files ;
import java.nio.file.Paths ;
public class Application {
public static void main ( String [] args ) throws IOException , ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
// Split the 2nd and 3rd slides and save them to PDF documents.
byte [] presentationData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
File responseFile = slidesApi . splitOnline ( presentationData , SlideExportFormat . PDF , null , null , 2 , 3 , null , null , null , null );
System . out . println ( "The output ZIP file was saved to " + responseFile . getPath ());
}
}
PHP
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-php
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
use Aspose\Slides\Cloud\Sdk\Model\SlideExportFormat ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "my_client_id" );
$configuration -> setAppKey ( "my_client_secret" );
$slidesApi = new SlidesApi ( null , $configuration );
// Split the 2nd and 3rd slides and save them to PDF documents.
$presentationStream = fopen ( "MyPresentation.pptx" , "r" );
$responseFile = $slidesApi -> splitOnline ( $presentationStream , SlideExportFormat :: PDF , null , null , 2 , 3 );
print ( "The output ZIP file was saved to " . $responseFile -> getPathname ());
Ruby
# For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-ruby
require "aspose_slides_cloud"
include AsposeSlidesCloud
configuration = Configuration . new
configuration . app_sid = "my_client_id"
configuration . app_key = "my_client_secret"
slides_api = SlidesApi . new ( configuration )
# Split the 2nd and 3rd slides and save them to PDF documents.
presentation_data = File . binread ( "MyPresentation.pptx" )
output_data = slides_api . split_online ( presentation_data , SlideExportFormat :: PDF , nil , nil , 2 , 3 )
# Save the output data to a ZIP file.
File . binwrite ( "output.zip" , output_data )
Python
# For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-python
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_export_format import SlideExportFormat
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
# Split the 2nd and 3rd slides and save them to PDF documents.
with open ( "MyPresentation.pptx" , "rb" ) as presentation_stream :
output_path = slides_api . split_online ( presentation_stream , SlideExportFormat . PDF , None , None , 2 , 3 )
print ( "The output ZIP file was saved to " + output_path )
Node.js
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-nodejs
const cloud = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
// Split the 2nd and 3rd slides and save them to PDF documents.
const presentationStream = fs . createReadStream ( "MyPresentation.pptx" );
slidesApi . splitOnline ( presentationStream , "pdf" , null , null , 2 , 3 ). then ( response => {
// Save the output data to a ZIP file.
fs . writeFile ( "output.zip" , response . body , ( error ) => {
if ( error ) throw error ;
});
});
Android
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-android
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.SlideExportFormat ;
import java.io.IOException ;
import java.nio.file.Files ;
import java.nio.file.Paths ;
public class Application {
public static void main ( String [] args ) throws ApiException , IOException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
// Split the 2nd and 3rd slides and save them to PDF documents.
byte [] presentationData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
File responseFile = slidesApi . splitOnline ( presentationData , SlideExportFormat . PDF , null , null , 2 , 3 , null , null , null , null );
System . out . println ( "The output ZIP file was saved to " + responseFile . getPath ());
}
}
C++
// For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-cpp
#include "asposeslidescloud/api/SlidesApi.h"
using namespace utility ;
using namespace utility :: conversions ;
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( to_string_t ( "my_client_id" ), to_string_t ( "my_client_secret" ));
// Prepare a request content.
auto presentationStream = std :: make_shared < std :: ifstream > ( "MyPresentation.pptx" , std :: ios :: binary );
auto requestContent = std :: make_shared < HttpContent > ();
requestContent -> setData ( presentationStream );
// Split the 2nd and 3rd slides and save them to PDF documents.
auto responseContent = slidesApi -> splitOnline ( requestContent , to_string_t ( "pdf" ), boost :: none , boost :: none , 2 , 3 ). get ();
// Save the output data to a ZIP file.
std :: ofstream outputStream ( "output.zip" , std :: ofstream :: binary );
responseContent . writeTo ( outputStream );
return 0 ;
}
Perl
# For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-perl
use File::Slurp ;
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "my_client_id" ;
$config -> { app_key } = "my_client_secret" ;
my $slides_api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
# Split the 2nd and 3rd slides and save them to PDF documents.
my $presentation_data = read_file ( "MyPresentation.pptx" , { binmode => ":raw" });
my %split_params = ( "document" => $presentation_data , "format" => "pdf" , "from" => 2 , "to" => 3 );
my $output_data = $slides_api -> split_online ( %split_params );
# Save the output data to a ZIP file.
write_file ( "output.zip" , { binmode => ":raw" }, $output_data );
Swift
Go
SDKs
Using an SDK (API client) is the quickest way for a developer to speed up development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of Aspose.Slides Cloud SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.