Convert a Presentation and Save It in a Specified Format to Storage Introduction
The following method allows you to transfer a PowerPoint presentation from a local file to a Cloud Storage, convert the presentation to a desired format and save the result in the storage.
API
Type
Description
Resource
/slides/convert/{format}
PUT
Converts a passed presentation to a specified format and saves the result to the storage.
ConvertAndSave
Request Parameters
Name
Type
Location
Required
Description
document
file
formData
true
The data of the presentation.
format
string
path
true
The desired format for the conversion.
outPath
string
query
true
The output file path to save the result in the storage.
password
string
header
false
The password to open the presentation.
storage
string
query
false
The name of the storage where the result will be located.
fontsFolder
string
query
false
The path to the storage folder containing the external fonts.
slides
string
query
false
The 1-based indices of the slides to be converted. If it is not specified, all slides are converted by default.
options
object
body
false
The format-specific options for the conversion.
To use fontsFolder parameter, you can create storage folders and upload font files to them using Slides Cloud API.
You can convert parts of presentations using the optional slides parameter.
You can specify format-specific options using the options parameter.
If the slides of the presentation are converted to separate images (for example, PNG, JPG, etc.), the result will be a ZIP archive, and the .zip
extension will be added to the output file name.
cURL Examples
Convert example.pptx presentation from a local file to PNG images and save the result to MyFolder/images.zip file in MyStorage storage.
SDK Source
Using an SDK (API client) is the quickest way for a developer to speed up the 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. The Aspose.Slides Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
Convert example.pptx presentation from a local file to PNG images and save the result to MyFolder/images.zip file in MyStorage storage.
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 Test
{
static void Main ( string [] args )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
using var fileStream = File . OpenRead ( "example.pptx" );
api . ConvertAndSave ( fileStream , ExportFormat . Png , "MyFolder/images" );
}
}
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.ExportFormat ;
import java.io.IOException ;
import java.nio.file.Files ;
import java.nio.file.Paths ;
public class Main {
public static void main ( String [] args ) throws ApiException , IOException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_key" );
byte [] fileData = Files . readAllBytes ( Paths . get ( "example.pptx" ));
slidesApi . convertAndSave ( fileData , ExportFormat . PNG , "MyFolder/images" , null , "MyStorage" , null , null , null );
}
}
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 ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "my_client_id" );
$configuration -> setAppKey ( "my_client_key" );
$slidesApi = new SlidesApi ( null , $configuration );
$fileStream = fopen ( "example.pptx" , 'r' );
$slidesApi -> convertAndSave ( $fileStream , "png" , "MyFolder/images" , null , "MyStorage" );
Ruby
# For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-ruby
require 'aspose_slides_cloud'
configuration = AsposeSlidesCloud :: Configuration . new
configuration . app_sid = "my_client_id"
configuration . app_key = "my_client_key"
slides_api = AsposeSlidesCloud :: SlidesApi . new ( configuration )
file_data = File . binread ( "example.pptx" )
slides_api . convert_and_save ( file_data , "png" , "MyFolder/images" , nil , "MyStorage" )
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
slides_api = SlidesApi ( None , "my_client_id" , "my_client_key" )
with open ( "example.pptx" , "rb" ) as file_stream :
slides_api . convert_and_save ( file_stream , "png" , "MyFolder/images" , None , "MyStorage" )
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_key" );
const fileStream = fs . createReadStream ( "example.pptx" );
slidesApi . convertAndSave ( fileStream , "png" , "MyFolder/images" , null , "MyStorage" ). then (() => {
});
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.ExportFormat ;
import java.io.IOException ;
import java.nio.file.Files ;
import java.nio.file.Paths ;
public class Main {
public static void main ( String [] args ) throws ApiException , IOException {
var slidesApi = new SlidesApi ( "my_client_id" , "my_client_key" );
var fileData = Files . readAllBytes ( Paths . get ( "example.pptx" ));
slidesApi . convertAndSave ( fileData , ExportFormat . PNG , "MyFolder/images" , null , "MyStorage" , null , null , null );
}
}
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 :: conversions ;
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = std :: make_shared < SlidesApi > ( to_string_t ( "my_client_id" ), to_string_t ( "my_client_key" ));
auto fileStream = std :: make_shared < std :: ifstream > ( "example.pptx" , std :: ios :: binary );
auto fileContent = std :: make_shared < HttpContent > ();
fileContent -> setData ( fileStream );
slidesApi -> convertAndSave ( fileContent , to_string_t ( "png" ), to_string_t ( "MyFolder/images" ), utility :: string_t (), to_string_t ( "MyStorage" )). get ();
return 0 ;
}
Perl
Swift
Go