Extract a Slide Introduction
The following request methods allow you to easily extract a particular slide from a PowerPoint document. At the same time, the slide may be converted to a specified format. It can be PowerPoint format, image, HTML, PDF, and many others. Depending on the output format, many options may be applied for the output document. You can keep the original size of the slide or specify a different one. A password can be provided when the presentation is protected. You can use the default storage and folder where the presentation was saved or specify them in parameters.
DownloadSlide
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/{format}
POST
Downloads the specified slide from a presentation saved to a storage.
DownloadSlide
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The file name of a presentation saved to a storage.
slideIndex
integer
path
true
The 1-based index of the slide to be downloaded.
format
string
path
true
The output format for the slide. See the table for available formats.
options
body
object
false
The export options depending on the output format. See conversion options for the available formats.
width
integer
query
false
The width of the slide in output format units. The default value is 0 (used the original width).
height
integer
query
false
The height of the slide in output format units. The default value is 0 (used the original height).
password
string
header
false
The password to open the presentation.
folder
string
query
false
The path to the folder containing the presentation.
storage
string
query
false
The name of the storage contaning the folder.
fontsFolder
string
query
false
The path to the storage folder contaning custom fonts to be used with the presentation.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
Extract the third slide from MyFolder/MyPresentation.pptx saved to MyStorage and convert it to a 540x380 TIFF image using 24bppRGB pixel format.
cURL Solution
SDK Solutions
C#
Copy
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" );
var tiffOptions = new TiffExportOptions
{
PixelFormat = TiffExportOptions . PixelFormatEnum . Format24bppRgb ,
Width = 540 ,
Height = 380
};
using var tiffStream = api . DownloadSlide ( "MyPresentation.pptx" , 3 , SlideExportFormat . Tiff , tiffOptions );
using var outputStream = File . OpenWrite ( "slide_3.tiff" );
tiffStream . CopyTo ( outputStream );
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
TiffExportOptions tiffOptions = new TiffExportOptions ();
tiffOptions . setPixelFormat ( TiffExportOptions . PixelFormatEnum . FORMAT24BPPRGB );
tiffOptions . setWidth ( 540 );
tiffOptions . setHeight ( 380 );
File tiffFile = slidesApi . downloadSlide ( "MyPresentation.pptx" , 3 , SlideExportFormat . TIFF , tiffOptions , null , null , null , "MyFolder" , "MyStorage" , null );
System . out . println ( "The TIFF image was saved to " + tiffFile . getPath ());
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \TiffExportOptions ;
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 );
$tiffOptions = new TiffExportOptions ();
$tiffOptions -> setPixelFormat ( "Format24bppRgb" );
$tiffOptions -> setWidth ( 540 );
$tiffOptions -> setHeight ( 380 );
$tiffFile = $slidesApi -> downloadSlide ( "MyPresentation.pptx" , 3 , SlideExportFormat :: TIFF , $tiffOptions , null , null , null , "MyFolder" , "MyStorage" );
print ( "The TIFF image was saved to " . $tiffFile -> getPathname ());
Ruby
Copy
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 )
tiff_options = TiffExportOptions . new
tiff_options . pixel_format = "Format24bppRgb"
tiff_options . width = 540
tiff_options . height = 380
tiff_data = slides_api . download_slide ( "MyPresentation.pptx" , 3 , SlideExportFormat :: TIFF , tiff_options , nil , nil , nil , "MyFolder" , "MyStorage" )
File . binwrite ( "slide_3.tiff" , tiff_data )
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_export_format import SlideExportFormat
from asposeslidescloud.models.tiff_export_options import TiffExportOptions
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
tiff_options = TiffExportOptions ()
tiff_options . pixel_format = "Format24bppRgb"
tiff_options . width = 540
tiff_options . height = 380
tiff_path = slides_api . download_slide ( "MyPresentation.pptx" , 3 , SlideExportFormat . TIFF , tiff_options , None , None , None , "MyFolder" , "MyStorage" )
print ( "The TIFF image was saved to " + tiff_path )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
const tiffOptions = new cloud . TiffExportOptions ();
tiffOptions . pixelFormat = "Format24bppRgb" ;
tiffOptions . width = 540 ;
tiffOptions . height = 380 ;
slidesApi . downloadSlide ( "MyPresentation.pptx" , 3 , "tiff" , tiffOptions , null , null , null , "MyFolder" , "MyStorage" ). then ( response => {
fs . writeFile ( "slide_3.tiff" , 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.* ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
TiffExportOptions tiffOptions = new TiffExportOptions ();
tiffOptions . setPixelFormat ( TiffExportOptions . PixelFormatEnum . FORMAT24BPPRGB );
tiffOptions . setWidth ( 540 );
tiffOptions . setHeight ( 380 );
File tiffFile = slidesApi . downloadSlide ( "MyPresentation.pptx" , 3 , SlideExportFormat . TIFF , tiffOptions , null , null , null , "MyFolder" , "MyStorage" , null );
System . out . println ( "The TIFF image was saved to " + tiffFile . getPath ());
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
#include "asposeslidescloud/model/TiffExportOptions.h"
using namespace utility ;
using namespace utility :: conversions ;
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto tiffOptions = std :: make_shared < TiffExportOptions > ();
tiffOptions -> setPixelFormat ( L "Format24bppRgb" );
tiffOptions -> setWidth ( 540 );
tiffOptions -> setHeight ( 380 );
auto responseContent = slidesApi -> downloadSlide (
L "MyPresentation.pptx" , 3 , L "tiff" , tiffOptions , NULL , NULL , L "" , L "MyFolder" , L "MyStorage" ). get ();
std :: ofstream tiffStream ( "slide_3.tiff" , std :: ofstream :: binary ) ;
responseContent . writeTo ( tiffStream );
}
Perl
Copy
use File::Slurp ;
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::TiffExportOptions ;
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 );
my $tiff_options = AsposeSlidesCloud::Object::TiffExportOptions -> new ();
$tiff_options -> { pixel_format } = "Format24bppRgb" ;
$tiff_options -> { width } = 540 ;
$tiff_options -> { height } = 380 ;
my %slide_params = ( name => "MyPresentation.pptx" , slide_index => 3 , format => "tiff" , options => $tiff_options , folder => "MyFolder" , storage => "MyStorage" );
my $tiff_data = $slides_api -> download_slide ( %slide_params );
write_file ( "slide_3.tiff" , { binmode => ":raw" }, $tiff_data );
Swift
Go
SaveSlide
API
Type
Description
Resource
/slides/{name}/slides/{slideIndex}/{format}
PUT
Extracts the specified slide from a presentation saved to a storage and saves the slide to the storage.
SaveSlide
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The file name of a presentation saved to a storage.
slideIndex
integer
path
true
The 1-based index of the slide to be extracted from the presentation.
format
string
path
true
The output format for the slide. See the table for available formats.
options
body
object
false
The export options depending on the output format. See conversion options for the available formats.
outPath
string
query
true
The output path for a slide file.
width
integer
query
false
The width of the slide in output format units. The default value is 0 (used the original width).
height
integer
query
false
The height of the slide in output format units. The default value is 0 (used the original height).
password
string
header
false
The password to open the presentation.
folder
string
query
false
The path to the folder containing the presentation.
storage
string
query
false
The name of the storage contaning the folder.
fontsFolder
string
query
false
The path to the storage folder contaning custom fonts to be used with the presentation.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
Extract the second slide from MyFolder/MyPresentation.pptx saved to MyStorage , and save the slide to MyImages/slide_2.png file. The image must contain slide notes and slide comments .
cURL Solution
SDK Solutions
C#
Copy
using Aspose.Slides.Cloud.Sdk ;
using Aspose.Slides.Cloud.Sdk.Model ;
class Application
{
static void Main ( string [] args )
{
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
ImageExportOptions pngOptions = new ImageExportOptions
{
SlidesLayoutOptions = new NotesCommentsLayoutingOptions
{
NotesPosition = NotesCommentsLayoutingOptions . NotesPositionEnum . BottomTruncated ,
CommentsPosition = NotesCommentsLayoutingOptions . CommentsPositionEnum . Right
}
};
api . SaveSlide ( "MyPresentation.pptx" , 2 , SlideExportFormat . Png , "MyImages/slide_2.png" , pngOptions );
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
NotesCommentsLayoutingOptions slidesLayoutOptions = new NotesCommentsLayoutingOptions ();
slidesLayoutOptions . setNotesPosition ( NotesCommentsLayoutingOptions . NotesPositionEnum . BOTTOMTRUNCATED );
slidesLayoutOptions . setCommentsPosition ( NotesCommentsLayoutingOptions . CommentsPositionEnum . RIGHT );
ImageExportOptions pngOptions = new ImageExportOptions ();
pngOptions . setSlidesLayoutOptions ( slidesLayoutOptions );
slidesApi . saveSlide ( "MyPresentation.pptx" , 2 , SlideExportFormat . PNG , "MyImages/slide_2.png" , pngOptions , null , null , null , "MyFolder" , "MyStorage" , null );
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \ImageExportOptions ;
use Aspose \Slides \Cloud \Sdk \Model \NotesCommentsLayoutingOptions ;
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 );
$slidesLayoutOptions = new NotesCommentsLayoutingOptions ();
$slidesLayoutOptions -> setNotesPosition ( "BottomTruncated" );
$slidesLayoutOptions -> setCommentsPosition ( "Right" );
$pngOptions = new ImageExportOptions ();
$pngOptions -> setSlidesLayoutOptions ( $slidesLayoutOptions );
$slidesApi -> saveSlide ( "MyPresentation.pptx" , 2 , SlideExportFormat :: PNG , "MyImages/slide_2.png" , $pngOptions , null , null , null , "MyFolder" , "MyStorage" );
Ruby
Copy
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 )
slides_layout_options = NotesCommentsLayoutingOptions . new
slides_layout_options . notes_position = "BottomTruncated"
slides_layout_options . comments_position = "Right"
png_options = ImageExportOptions . new
png_options . slides_layout_options = slides_layout_options
slides_api . save_slide ( "MyPresentation.pptx" , 2 , SlideExportFormat :: PNG , "MyImages/slide_2.png" , png_options , nil , nil , nil , "MyFolder" , "MyStorage" )
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_export_format import SlideExportFormat
from asposeslidescloud.models.image_export_options import ImageExportOptions
from asposeslidescloud.models.image_export_options import NotesCommentsLayoutingOptions
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
slides_layout_options = NotesCommentsLayoutingOptions ()
slides_layout_options . notes_position = "BottomTruncated"
slides_layout_options . comments_position = "Right"
png_options = ImageExportOptions ()
png_options . slides_layout_options = slides_layout_options
slides_api . save_slide ( "MyPresentation.pptx" , 2 , SlideExportFormat . PNG , "MyImages/slide_2.png" , png_options , None , None , None , "MyFolder" , "MyStorage" )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
const slidesLayoutOptions = new cloud . NotesCommentsLayoutingOptions ();
slidesLayoutOptions . notesPosition = "BottomTruncated" ;
slidesLayoutOptions . commentsPosition = "Right" ;
const pngOptions = new cloud . ImageExportOptions ();
pngOptions . slidesLayoutOptions = slidesLayoutOptions ;
slidesApi . saveSlide ( "MyPresentation.pptx" , 2 , "png" , "MyImages/slide_2.png" , pngOptions , null , null , null , "MyFolder" , "MyStorage" ). then (() => {
});
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
#include "asposeslidescloud/model/ImageExportOptions.h"
#include "asposeslidescloud/model/NotesCommentsLayoutingOptions.h"
using namespace utility ;
using namespace utility :: conversions ;
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto slidesLayoutOptions = std :: make_shared < NotesCommentsLayoutingOptions > ();
slidesLayoutOptions -> setNotesPosition ( L "BottomTruncated" );
slidesLayoutOptions -> setCommentsPosition ( L "Right" );
auto pngOptions = std :: make_shared < ImageExportOptions > ();
pngOptions -> setSlidesLayoutOptions ( slidesLayoutOptions );
slidesApi -> saveSlide (
L "MyPresentation.pptx" , 2 , L "png" , L "MyImages/slide_2.png" , pngOptions , NULL , NULL , L "" , L "MyFolder" , L "MyStorage" ). get ();
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::ImageExportOptions ;
use AsposeSlidesCloud::Object::NotesCommentsLayoutingOptions ;
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 );
my $slides_layout_options = AsposeSlidesCloud::Object::NotesCommentsLayoutingOptions -> new ();
$slides_layout_options -> { notes_position } = "BottomTruncated" ;
$slides_layout_options -> { comments_position } = "Right" ;
my $png_options = AsposeSlidesCloud::Object::ImageExportOptions -> new ();
$png_options -> { slides_layout_options } = $slides_layout_options ;
my %params = ( name => "MyPresentation.pptx" , slide_index => 2 , format => "png" , out_path => "MyImages/slide_2.png" ,
options => $png_options , folder => "MyFolder" , storage => "MyStorage" );
$slides_api -> save_slide ( %params );
Swift
Go
DownloadSlideOnline
API
Type
Description
Resource
/slides/slides/{slideIndex}/{format}
POST
Uploads a presentation to a storage and downloads the specified slide from the presentation.
DownloadSlideOnline
Request Parameters
Name
Type
Location
Required
Description
document
file
formData
true
The presentation file data.
slideIndex
integer
path
true
The 1-based index of the slide to be downloaded.
format
string
path
true
The output format for the slide. See the table for available formats.
width
integer
query
false
The width of the slide in output format units. The default value is 0 (used the original width).
height
integer
query
false
The height of the slide in output format units. The default value is 0 (used the original height).
password
string
header
false
The password to open the presentation.
fontsFolder
string
query
false
The path to the storage folder contaning custom fonts to be used with the presentation.
storage
string
query
false
The name of the storage.
options
body
object
false
The export options depending on the output format. See conversion options for the available formats.
Examples
Extract the fifth slide from MyPresentation.pptx and convert it to a PDF document using the PDF/A-1b standard. Embed all font characters in the output document and set the quality value for JPG images to 90% .
cURL Solution
SDK Solutions
C#
Copy
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" );
using var fileStream = File . OpenRead ( "MyPresentation.pptx" );
var pdfOptions = new PdfExportOptions
{
Compliance = PdfExportOptions . ComplianceEnum . PdfA1b ,
EmbedFullFonts = true ,
JpegQuality = 90
};
using var pdfStream = api . DownloadSlideOnline ( fileStream , 5 , SlideExportFormat . Pdf , options : pdfOptions );
using var outputStream = File . OpenWrite ( "slide_5.pdf" );
pdfStream . CopyTo ( outputStream );
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
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" );
byte [] fileData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
PdfExportOptions pdfOptions = new PdfExportOptions ();
pdfOptions . setCompliance ( PdfExportOptions . ComplianceEnum . PDFA1B );
pdfOptions . setEmbedFullFonts ( true );
pdfOptions . setJpegQuality ( 90 );
File pdfFile = slidesApi . downloadSlideOnline ( fileData , 5 , SlideExportFormat . PDF , null , null , null , null , null , pdfOptions );
System . out . println ( "The PDF document was saved to " + pdfFile . getPath ());
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \PdfExportOptions ;
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 );
$fileStream = fopen ( "MyPresentation.pptx" , 'r' );
$pdfOptions = new PdfExportOptions ();
$pdfOptions -> setCompliance ( "PdfA1b" );
$pdfOptions -> setEmbedFullFonts ( true );
$pdfOptions -> setJpegQuality ( 90 );
$pdfFile = $slidesApi -> downloadSlideOnline ( $fileStream , 5 , SlideExportFormat :: PDF , null , null , null , null , null , $pdfOptions );
echo "The PDF document was saved to " , $pdfFile -> getPathname ();
Ruby
Copy
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 )
file_data = File . binread ( "MyPresentation.pptx" )
pdf_options = PdfExportOptions . new
pdf_options . compliance = "PdfA1b"
pdf_options . embed_full_fonts = true
pdf_options . jpeg_quality = 90
pdf_data = slides_api . download_slide_online ( file_data , 5 , SlideExportFormat :: PDF , nil , nil , nil , nil , nil , pdf_options )
File . binwrite ( "slide_5.pdf" , pdf_data )
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_export_format import SlideExportFormat
from asposeslidescloud.models.pdf_export_options import PdfExportOptions
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
pdf_options = PdfExportOptions ()
pdf_options . compliance = "PdfA1b"
pdf_options . embed_full_fonts = True
pdf_options . jpeg_quality = 90
with open ( "MyPresentation.pptx" , "rb" ) as file_stream :
pdf_file_path = slides_api . download_slide_online ( file_stream . read (), 5 , SlideExportFormat . PDF , None , None , None , None , None , pdf_options )
print ( "The PDF document was saved to " , pdf_file_path )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
const fileStream = fs . createReadStream ( "MyPresentation.pptx" );
const pdfOptions = new cloud . PdfExportOptions ();
pdfOptions . compliance = "PdfA1b" ;
pdfOptions . embedFullFonts = true ;
pdfOptions . jpegQuality = 90 ;
slidesApi . downloadSlideOnline ( fileStream , 5 , cloud . SlideExportFormat . Pdf , null , null , null , null , null , pdfOptions ). then ( response => {
fs . writeFile ( "slide_5.pdf" , 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.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" );
byte [] fileData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
PdfExportOptions pdfOptions = new PdfExportOptions ();
pdfOptions . setCompliance ( PdfExportOptions . ComplianceEnum . PDFA1B );
pdfOptions . setEmbedFullFonts ( true );
pdfOptions . setJpegQuality ( 90 );
File pdfFile = slidesApi . downloadSlideOnline ( fileData , 5 , SlideExportFormat . PDF , null , null , null , null , null , pdfOptions );
System . out . println ( "The PDF document was saved to " + pdfFile . getPath ());
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
#include "asposeslidescloud/model/PdfExportOptions.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto fileStream = std :: make_shared < std :: ifstream > ( "MyPresentation.pptx" , std :: ios :: binary );
auto fileContent = std :: make_shared < HttpContent > ();
fileContent -> setData ( fileStream );
auto pdfOptions = std :: make_shared < PdfExportOptions > ();
pdfOptions -> setCompliance ( L "PdfA1b" );
pdfOptions -> setEmbedFullFonts ( true );
pdfOptions -> setJpegQuality ( 90 );
auto pdfContent = slidesApi -> downloadSlideOnline (
fileContent , 5 , L "pdf" , NULL , NULL , L "" , L "" , L "" , pdfOptions ). get ();
std :: ofstream outputStream ( "slide_5.pdf" , std :: ofstream :: binary ) ;
pdfContent . writeTo ( outputStream );
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::PdfExportOptions ;
use File::Slurp ;
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 );
my $file_data = read_file ( "MyPresentation.pptx" , { binmode => ":raw" });
my $pdf_options = AsposeSlidesCloud::Object::PdfExportOptions -> new ();
$pdf_options -> { compliance } = "PdfA1b" ;
$pdf_options -> { embed_full_fonts } = true ;
$pdf_options -> { jpeg_quality } = 90 ;
my %parameters = ( document => $file_data , slide_index => 5 , format => "pdf" , options => $pdf_options );
my $pdf_data = $slides_api -> download_slide_online ( %parameters );
write_file ( "slide_5.pdf" , { binmode => ":raw" }, $pdf_data );
Swift
Go
SaveSlideOnline
API
Type
Description
Resource
/slides/slides/{slideIndex}/{format}
PUT
Uploads a presentation to a storage, extracts the specified slide from the presentation, and saves the slide to the storage.
SaveSlideOnline
Name
Type
Location
Required
Description
document
file
formData
true
The presentation file data.
slideIndex
integer
path
true
The 1-based index of the slide to be extracted from the presentation.
format
string
path
true
The output format for the slide. See the table for available formats.
outPath
string
query
true
The output path for a slide file.
width
integer
query
false
The width of the slide in output format units. The default value is 0 (used the original width).
height
integer
query
false
The height of the slide in output format units. The default value is 0 (used the original height).
password
string
header
false
The password to open the presentation.
storage
string
query
false
The name of the storage.
fontsFolder
string
query
false
The path to the storage folder contaning custom fonts to be used with the presentation.
options
body
object
false
The export options depending on the output format. See conversion options for the available formats.
Examples
Extract the fourth slide from MyPresentation.pptx and save it to MyImages/slide_4.svg file in SVG format using MyStorage . Embed external fonts from MyFonts folder to the output file.
cURL Solution
SDK Solutions
C#
Copy
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" );
using var fileStream = File . OpenRead ( "MyPresentation.pptx" );
var svgOptions = new SvgExportOptions
{
ExternalFontsHandling = SvgExportOptions . ExternalFontsHandlingEnum . Embed
};
api . SaveSlideOnline ( fileStream , 4 , SlideExportFormat . Svg , "MyImages/slide_4.svg" , null , null , null , null , null , svgOptions );
}
}
Java
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
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" );
byte [] fileData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
SvgExportOptions svgOptions = new SvgExportOptions ();
svgOptions . setExternalFontsHandling ( SvgExportOptions . ExternalFontsHandlingEnum . EMBED );
slidesApi . saveSlideOnline ( fileData , 4 , SlideExportFormat . SVG , "MyImages/slide_4.svg" , null , null , null , "MyStorage" , "MyFonts" , svgOptions );
}
}
PHP
Copy
use Aspose \Slides \Cloud \Sdk \Api \Configuration ;
use Aspose \Slides \Cloud \Sdk \Api \SlidesApi ;
use Aspose \Slides \Cloud \Sdk \Model \SvgExportOptions ;
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 );
$fileStream = fopen ( "MyPresentation.pptx" , 'r' );
$svgOptions = new SvgExportOptions ();
$svgOptions -> setExternalFontsHandling ( "Embed" );
$slidesApi -> saveSlideOnline ( $fileStream , 4 , SlideExportFormat :: SVG , "MyImages/slide_4.svg" , null , null , null , "MyStorage" , "MyFonts" , $svgOptions );
Ruby
Copy
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 )
file_data = File . binread ( "MyPresentation.pptx" )
svg_options = SvgExportOptions . new
svg_options . external_fonts_handling = "Embed"
slides_api . save_slide_online ( file_data , 4 , SlideExportFormat :: SVG , "MyImages/slide_4.svg" , nil , nil , nil , "MyStorage" , "MyFonts" , svg_options )
Python
Copy
import asposeslidescloud
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.slide_export_format import SlideExportFormat
from asposeslidescloud.models.svg_export_options import SvgExportOptions
slides_api = SlidesApi ( None , "my_client_id" , "my_client_secret" )
svg_options = SvgExportOptions ()
svg_options . external_fonts_handling = "Embed"
with open ( "MyPresentation.pptx" , "rb" ) as file_stream :
file_data = file_stream . read ()
slides_api . save_slide_online ( file_data , 4 , SlideExportFormat . SVG , "MyImages/slide_4.svg" , None , None , None , "MyStorage" , "MyFonts" , svg_options )
Node.js
Copy
const cloud = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
const fileStream = fs . createReadStream ( "MyPresentation.pptx" );
const svgOptions = new cloud . SvgExportOptions ();
svgOptions . externalFontsHandling = "Embed" ;
slidesApi . saveSlideOnline ( fileStream , 4 , cloud . SlideExportFormat . Svg , "MyImages/slide_4.svg" , null , null , null , "MyStorage" , "MyFonts" , svgOptions ). then (() => {
});
Android
Copy
import com.aspose.slides.ApiException ;
import com.aspose.slides.api.SlidesApi ;
import com.aspose.slides.model.* ;
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" );
byte [] fileData = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
SvgExportOptions svgOptions = new SvgExportOptions ();
svgOptions . setExternalFontsHandling ( SvgExportOptions . ExternalFontsHandlingEnum . EMBED );
slidesApi . saveSlideOnline ( fileData , 4 , SlideExportFormat . SVG , "MyImages/slide_4.svg" , null , null , null , "MyStorage" , "MyFonts" , svgOptions );
}
}
C++
Copy
#include "asposeslidescloud/api/SlidesApi.h"
#include "asposeslidescloud/model/SvgExportOptions.h"
using namespace asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
auto fileStream = std :: make_shared < std :: ifstream > ( "MyPresentation.pptx" , std :: ios :: binary );
auto fileContent = std :: make_shared < HttpContent > ();
fileContent -> setData ( fileStream );
auto svgOptions = std :: make_shared < SvgExportOptions > ();
svgOptions -> setExternalFontsHandling ( L "Embed" );
slidesApi -> saveSlideOnline (
fileContent , 4 , L "svg" , L "MyImages/slide_4.svg" , NULL , NULL , L "" , L "MyStorage" , L "MyFonts" , svgOptions ). get ();
return 0 ;
}
Perl
Copy
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::SvgExportOptions ;
use File::Slurp ;
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 );
my $file_data = read_file ( "MyPresentation.pptx" , { binmode => ":raw" });
my $svg_options = AsposeSlidesCloud::Object::SvgExportOptions -> new ();
$svg_options -> { external_fonts_handling } = "Embed" ;
my %parameters = ( document => $file_data , slide_index => 4 , format => "svg" , out_path => "MyImages/slide_4.svg" ,
storage => "MyStorage" , fonts_folder => "MyFonts" , options => $svg_options );
$slides_api -> save_slide_online ( %parameters );
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.