Download a Presentation in a Specified Format from Storage Introduction
The following method allows you to download a PowerPoint presentation located in a Cloud Storage in a desired format.
API
Type
Description
Resource
/slides/{name}/{format}
POST
Converts a presentation located in a storage to a specified format and returns the result.
DownloadPresentation
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The file name of the presentation.
format
string
path
true
The desired format for the conversion.
options
object
body
false
The format-specific options for the conversion.
password
string
header
false
The password to open the presentation.
folder
string
query
false
The folder path where the presentation is located.
storage
string
query
false
The name of the storage where the presentation is located.
fontsFolder
string
query
false
The path to the storage folder containing external fonts.
slides
string
query
false
The 1-based indices of the slides to be saved. If it is not specified, all slides are saved by default.
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
Download MyFolder/example.pptx presentation from MyStorage storage and save it as output.html document. The document should only contain the slides with indexes 2 and 4 . The Helvetica font should be used in case a presentation font is not found.
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
Download MyFolder/example.pptx presentation from MyStorage storage and save it in HTML format. The document should only contain slides with indexes 2 and 4 . The Helvetica font should be used in case some presentation fonts are not found.
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using Aspose.Slides.Cloud.Sdk.Model ;
using System.Collections.Generic ;
using System.IO ;
class Test
{
static void Main ( string [] args )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
var htmlOptions = new HtmlExportOptions { DefaultRegularFont = "Helvetica" };
var slideIndices = new List < int > { 2 , 4 };
using var htmlStream = api . DownloadPresentation (
"example.pptx" , ExportFormat . Html , htmlOptions , slides : slideIndices );
using Stream outputStream = File . Create ( "output.html" );
htmlStream . CopyTo ( outputStream );
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
import java.util.Arrays ;
public class Main {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_key" );
HtmlExportOptions htmlOptions = new HtmlExportOptions ();
htmlOptions . setDefaultRegularFont ( "Helvetica" );
ArrayList slideIndices = new ArrayList ( Arrays . asList ( 2 , 4 ));
File response = slidesApi . downloadPresentation (
"example.pptx" , ExportFormat . HTML , htmlOptions , null , "MyFolder" , "MyStorage" , null , slideIndices );
System . out . println ( "The HTML document was saved to " + response . getPath ());
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \HtmlExportOptions ;
use Aspose \Slides \Cloud \Sdk \Model \ExportFormat ;
$configuration = new Configuration ();
$configuration -> setAppSid ( "my_client_id" );
$configuration -> setAppKey ( "my_client_key" );
$slidesApi = new SlidesApi ( null , $configuration );
$htmlOptions = new HtmlExportOptions ();
$htmlOptions -> setDefaultRegularFont ( "Helvetica" );
$slideIndices = [ 2 , 4 ];
$response = $slidesApi -> downloadPresentation (
"example.pptx" , ExportFormat :: HTML , $htmlOptions , null , "MyFolder" , "MyStorage" , null , $slideIndices );
print ( "The HTML document was saved to " . $response -> getPathname ());
Ruby
Copy
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 )
html_options = AsposeSlidesCloud :: HtmlExportOptions . new
html_options . default_regular_font = "Helvetica"
slide_indices = [ 2 , 4 ]
html_data = slides_api . download_presentation (
"example.pptx" , "html" , html_options , nil , "MyFolder" , "MyStorage" , nil , slide_indices )
File . binwrite ( "output.html" , html_data )
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.html_export_options import HtmlExportOptions
from asposeslidescloud.models.export_format import ExportFormat
slides_api = SlidesApi ( None , "my_client_id" , "my_client_key" )
html_options = HtmlExportOptions ()
html_options . default_regular_font = "Helvetica"
slide_indices = [ 2 , 4 ]
html_path = slides_api . download_presentation (
"example.pptx" , ExportFormat . HTML , html_options , None , "MyFolder" , "MyStorage" , None , slide_indices )
print ( 'The HTML document was saved to ' + html_path )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_key" );
const htmlOptions = new cloud . HtmlExportOptions ();
htmlOptions . defaultRegularFont = "Helvetica" ;
const slideIndices = [ 2 , 4 ];
slidesApi . downloadPresentation ( "example.pptx" , cloud . ExportFormat . Html , htmlOptions , null , "MyFolder" , "MyStorage" , null , slideIndices ). then ( response => {
fs . writeFile ( "output.html" , response . body , ( error ) => {
if ( error ) throw error ;
});
});
Android
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
import java.util.Arrays ;
public class Main {
public static void main ( String [] args ) throws ApiException {
var slidesApi = new SlidesApi ( "my_client_id" , "my_client_key" );
var htmlOptions = new HtmlExportOptions ();
htmlOptions . setDefaultRegularFont ( "Helvetica" );
var slideIndices = Arrays . asList ( 2 , 4 );
var response = slidesApi . downloadPresentation (
"example.pptx" , ExportFormat . HTML , htmlOptions , null , "MyFolder" , "MyStorage" , null , slideIndices );
System . out . println ( "The HTML document was saved to " + response . getPath ());
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
#include "asposeslidescloud/model/HtmlExportOptions.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 htmlOptions = std :: make_shared < HtmlExportOptions > ();
htmlOptions -> setDefaultRegularFont ( to_string_t ( "Helvetica" ));
auto slideIndices = { 2 , 4 };
auto htmlContent = slidesApi -> downloadPresentation (
to_string_t ( "example.pptx" ), to_string_t ( "html" ), htmlOptions , utility :: string_t (), to_string_t ( "MyFolder" ), to_string_t ( "MyStorage" ), utility :: string_t (), slideIndices ). get ();
std :: ofstream htmlStream ( to_string_t ( "output.html" ), std :: ofstream :: binary ) ;
htmlContent . writeTo ( htmlStream );
return 0 ;
}
Perl
Swift
Go