Convert Using Handout Layouting Options Introduction
You can convert presentations to some formats (PDF , TIFF , HTML and images) using print handout master. To do that, use a HandoutLayoutingOptions object for SlidesLayoutOptions property of export options.
The example below shows conversion to PDF using two-slide handout.
cURL Example
SDK Source
The Aspose for Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
C#
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
PdfExportOptions exportOptions = new PdfExportOptions
{
SlidesLayoutOptions = new HandoutLayoutingOptions
{
Handout = HandoutLayoutingOptions . HandoutEnum . Handouts2 ,
PrintSlideNumbers = true
}
};
using Stream response = api . DownloadPresentation ( "MyPresentation.pptx" , ExportFormat . Pdf , exportOptions );
using Stream outFile = File . Create ( "MyPresentation.pdf" );
response . CopyTo ( outFile );
Java
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
HandoutLayoutingOptions slidesLayoutOptions = new HandoutLayoutingOptions ();
slidesLayoutOptions . setHandout ( HandoutLayoutingOptions . HandoutEnum . HANDOUTS2 );
slidesLayoutOptions . setPrintSlideNumbers ( true );
PdfExportOptions exportOptions = new PdfExportOptions ();
exportOptions . setSlidesLayoutOptions ( slidesLayoutOptions );
File response = api . downloadPresentation ( "MyPresentation.pptx" , ExportFormat . PDF , exportOptions , null , null , null , null , null );
System . out . println ( "The converted file was saved to " + response . getPath ());
PHP
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
use Aspose\Slides\Cloud\Sdk\Model\ExportFormat ;
use Aspose\Slides\Cloud\Sdk\Model\PdfExportOptions ;
use Aspose\Slides\Cloud\Sdk\Model\HandoutLayoutingOptions ;
$config = new Configuration ();
$config -> setAppSid ( "MyClientId" );
$config -> setAppKey ( "MyClientSecret" );
$api = new SlidesApi ( null , $config );
$slidesLayoutOptions = new HandoutLayoutingOptions ();
$slidesLayoutOptions -> setHandout ( "Handouts2" );
$slidesLayoutOptions -> setPrintSlideNumbers ( true );
$exportOptions = new PdfExportOptions ();
$exportOptions -> setSlidesLayoutOptions ( $slidesLayoutOptions );
$result = $api -> downloadPresentation ( "MyPresentation.pptx" , "pdf" , $exportOptions );
print ( "The converted file was saved to " . $result -> getPathname ());
Ruby
configuration = AsposeSlidesCloud :: Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
api = AsposeSlidesCloud :: SlidesApi . new ( configuration )
slides_layout_options = AsposeSlidesCloud :: HandoutLayoutingOptions . new
slides_layout_options . handout = "Handouts2"
slides_layout_options . print_slide_numbers = True
export_options = AsposeSlidesCloud :: PdfExportOptions . new
export_options . slides_layout_options = slides_layout_options
result = api . download_presentation ( "MyPresentation.pptx" , AsposeSlidesCloud :: ExportFormat :: PDF , export_options )
File . binwrite ( "MyPresentation.pdf" , result )
Python
import asposeslidescloud
from asposeslidescloud.configuration import Configuration
from asposeslidescloud.apis.slides_api import SlidesApi
from asposeslidescloud.models.export_format import ExportFormat
from asposeslidescloud.models.image_export_options import ImageExportOptions
from asposeslidescloud.models.font_fallback_rule import FontFallbackRule
configuration = Configuration ()
configuration . app_sid = 'MyClientId'
configuration . app_key = 'MyClientSecret'
api = SlidesApi ( configuration )
slides_layout_options = HandoutLayoutingOptions ()
slides_layout_options . handout = "Handouts2"
slides_layout_options . print_slide_numbers = True
export_options = PdfExportOptions ()
export_options . slides_layout_options = slides_layout_options
result = api . download_presentation ( "MyPresentation.pptx" , ExportFormat . PDF , export_options )
print ( 'The converted file was saved to ' + result )
Node.js
const CloudSdk = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const api = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const slidesLayoutOptions = new CloudSdk . HandoutLayoutingOptions ();
slidesLayoutOptions . handout = CloudSdk . HandoutLayoutingOptions . HandoutEnum . Handouts2 ;
slidesLayoutOptions . printSlideNumbers = true ;
const exportOptions = new CloudSdk . PdfExportOptions ();
exportOptions . slidesLayoutOptions = slidesLayoutOptions ;
api . downloadPresentation ( "MyPresentation.pptx" , CloudSdk . ExportFormat . Pdf , exportOptions ). then ( response => {
fs . writeFile ( "MyPresentation.pdf" , response . body , ( err ) => {
if ( err ) throw err ;
});
});
Go
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
slideLayoutOptions := slidescloud . NewHandoutLayoutingOptions ()
slideLayoutOptions . SetHandout ( "Handouts2" )
slideLayoutOptions . SetPrintSlideNumbers ( true )
exportOptions := slidescloud . NewPdfExportOptions ()
exportOptions . SetSlidesLayoutOptions ( slideLayoutOptions )
result , _ , e := api . SlidesApi . DownloadPresentation ( "MyPresentation.pptx" , "pdf" , exportOptions , "" , "" , "" , "" , nil )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "The converted file was saved to %v." , result . Name ())
C++
Perl
use File::Slurp ;
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::FontFallbackRule ;
use AsposeSlidesCloud::Object::ImageExportOptions ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
my $slides_layout_options = AsposeSlidesCloud::Object::HandoutLayoutingOptions -> new ();
$slides_layout_options -> { handout } = "Handouts2" ;
$slides_layout_options -> { print_slide_numbers } = 1 ;
my $export_options = AsposeSlidesCloud::Object::PdfExportOptions -> new ();
$export_options -> { slides_layout_options } = $slides_layout_options ;
my %params = ( 'name' => "MyPresentation.pptx" , 'format' => 'Pdf' , 'options' => $export_options );
my $result = $api -> download_presentation ( %params );
my $zip = "MyPresentation.pdf" ;
open my $fh , '>' , $zip ;
binmode $fh ;
print $fh $result ;
close $fh ;
Swift