Copy Slides Introduction
Aspose.Slides Cloud lets you easily copy a slide with its content to create a new slide in a PowerPoint presentation. The presentation must be already saved to a storage. You can copy a slide at the end of the presentation or at a specified position. You can copy a slide either within the same presentation or by specifying an original one. In the second case, the original presentation must also be in the Cloud storage. Both presentations can be password protected and you can specify passwords.
CopySlide
API
Type
Description
Resource
/slides/{name}/slides/copy
POST
Copies a slide to create a new slide.
CopySlide
Request Parameters
Name
Type
Location
Required
Description
name
string
path
true
The name of a presentation file.
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
.
slideToCopy
integer
query
true
The 1-based index of the slide to be copied from the source presentation.
position
integer
query
false
The 1-based index for the new slide. If the position is not specified, the slide will be added to the end.
source
string
query
false
The name of the presentation file to copy the slide from. If not specified, the slide is copied from the current presentation.
sourcePassword
string
header
false
The password for the presentation to copy the slide from.
sourceStorage
string
query
false
The name of the storage contaning the source presentation.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
Examples
Copy a slide at index 4 from MyResources/MyCharts.pptx file saved to the default storage and paste it at index 2 into MyFolder/MyPresentation.pptx file saved to MyStorage .
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 System ;
class Application
{
static void Main ()
{
var api = new SlidesApi ( "my_client_id" , "my_client_secret" );
// Copy the fourth slide.
var response = api . CopySlide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , null , null , null , "MyFolder" , "MyStorage" );
// Print links to all slides from MyPresentation.pptx.
foreach ( var resourceUri in response . SlideList )
{
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
Console . WriteLine ( resourceUri . Href );
}
}
}
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 ;
public class Application {
public static void main ( String [] args ) throws ApiException {
SlidesApi slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
// Copy the fourth slide.
Slides response = slidesApi . copySlide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , null , null , null , "MyFolder" , "MyStorage" );
// Print links to all slides from MyPresentation.pptx.
for ( ResourceUri resourceUri : response . getSlideList ()) {
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
System . out . println ( resourceUri . getHref ());
}
}
}
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_secret" );
$slidesApi = new SlidesApi ( null , $configuration );
// Copy the fourth slide.
$response = $slidesApi -> copySlide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , null , null , null , "MyFolder" , "MyStorage" );
// Print links to all slides from MyPresentation.pptx.
foreach ( $response -> getSlideList () as $resourceUri ) {
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
echo $resourceUri -> getHref (), " \n " ;
}
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 )
# Copy the fourth slide.
response = slides_api . copy_slide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , nil , nil , nil , "MyFolder" , "MyStorage" )
# Print links to all slides from MyPresentation.pptx.
for resource_uri in response . slide_list
# Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
puts resource_uri . href
end
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_secret" )
# Copy the fourth slide.
response = slides_api . copy_slide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , None , None , None , "MyFolder" , "MyStorage" )
# Print links to all slides from MyPresentation.pptx.
for resource_uri in response . slide_list :
# Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
print ( resource_uri . href )
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 slidesApi = new cloud . SlidesApi ( "my_client_id" , "my_client_secret" );
// Copy the fourth slide.
slidesApi . copySlide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , null , null , null , "MyFolder" , "MyStorage" ). then ( response => {
// Print links to all slides from MyPresentation.pptx.
response . body . slideList . forEach ( resourceUri => {
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
console . log ( resourceUri . href );
});
});
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 ;
public class Application {
public static void main ( String [] args ) throws ApiException {
var slidesApi = new SlidesApi ( "my_client_id" , "my_client_secret" );
// Copy the fourth slide.
var response = slidesApi . copySlide ( "MyPresentation.pptx" , 4 , 2 , "MyResources/MyCharts.pptx" , null , null , null , "MyFolder" , "MyStorage" );
// Print links to all slides from MyPresentation.pptx.
for ( var resourceUri : response . getSlideList ()) {
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
System . out . println ( resourceUri . getHref ());
}
}
}
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 asposeslidescloud :: api ;
int main ()
{
auto slidesApi = new SlidesApi ( L "my_client_id" , L "my_client_secret" );
// Copy the fourth slide.
auto response = slidesApi -> copySlide (
L "MyPresentation.pptx" , 4 , 2 , L "MyResources/MyCharts.pptx" , L "" , L "" , L "" , L "MyFolder" , L "MyStorage" ). get ();
// Print links to all slides from MyPresentation.pptx.
for ( auto resourceUri : response -> getSlideList ()) {
// Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
std :: wcout << resourceUri -> getHref () << std :: endl ;
}
return 0 ;
}
Perl
# For complete examples and data files, please go to https://github.com/aspose-Slides-cloud/aspose-Slides-cloud-perl
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 );
# Copy the fourth slide.
my %parameters = ( name => "MyPresentation.pptx" , slide_to_copy => 4 , position => 2 ,
source => "MyResources/MyCharts.pptx" , folder => "MyFolder" , storage => "MyStorage" );
my $response = $slides_api -> copy_slide ( %parameters );
# Print links to all slides from MyPresentation.pptx.
for my $resource_uri ( @ { $response -> { slide_list }}) {
# Output: https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/slides/1?folder=MyFolder etc.
print $resource_uri -> { href }, "\n" ;
}
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.