We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ASPOSE.SLIDE Java- Presentation Cloning in PHP


I have just put together a script for cloning of presentations, it takes about close to 3 minutes to clone 60 slides from a single presentation of 60 pages, 5MB in size. See my environment below:

OS: Ubuntu
Webservers: NGINX & TomCat using JavaBridge
PHP version 7.3
Double Core server
ASPOSE Version: 19.1

See the code, below. Can you please cast an eye and let me know if any improvement can be made to how we call the component.

    #get related slides query
    $result = $shoppingbasket->getselectedSlidesByPresID($ids, $iUserID);
    #set full file path
    $sourceFile = $PPTFolder . $ids . '/' . $sFilenames[$i];
    $slideID_arr = array();
    #get the deck you are getting slides from
    $pres1 = new java("com.aspose.slides.Presentation", $sourceFile);
    #get the new deck just created
    $pres2 = new java("com.aspose.slides.Presentation", $destinationFileName);
    #get the size, heaight and weight of the source file to be used to format the destination file
    $size = $pres1->getSlideSize()->getSize();
    #then set the desitnation file with the size dimension got above.
    $pres2->getSlideSize()->setSize( $size->getWidth(),$size->getHeight(),1 /*SlideSizeScaleType*/);

    #getting slides to use from the database.
    while ($row = $result->fetch(PDO::FETCH_ASSOC))
        #Get iSlideIDs
        array_push($slideID_arr, $iSlideID);
    #lenth of all related slides.
     $slideLength = sizeOf($slideID_arr);
     #loop over related slides
    for($j=1; $j <= $slideLength; $j++)
        $slidePosition = $j - 1;

        $slds = $pres2->getSlides();

        #To make sure formatting is not lost when replacing text
        $saveFormat= new java("com.aspose.slides.SaveFormat");
        #Write the presentation to disk
        $pres2->save($destinationFileName, $saveFormat->Pptx);
$pres2->save($destinationFileName, $saveFormat->Pptx);```


I have observed your sample code and it looks fine. Can you please try to use Aspose.Slides latest version 19.4 on your end and share feedback with us.

1 Like

@Adnan.Ahmad - I have just done a couple of hours of test. What is really clear is that your current versions of ASPOSE.SLIDE Java, 19.x has added, in some cases, 2-3 minutes to clone 60 slides of a single PPTX from the same presentation.

Versions 18.x seems to play better with the same slide, the same slide was cloned in 35 seconds.

Is this a known issue? If it is, has it been added to the bug list?



Can you please share source files along with generated result so that we may further investigate to help you out.

Hi - Thanks for getting back to us. We were actually looking to upgrade from version 16.x to 19.x. The difference in cloning time is just way too huge.

To be specific. We tested the 60 pages slide deck on version 19.4 of Aspose.Slides Java and version 16.8.0 .

As you know there are couple of things that needed tweaking because of breaking changes from 18.x through to 19.x. Such as getting the right dimensions when cloning, e.g. as below.

$pres2->getSlideSize()->setSize( $size->getWidth(),$size->getHeight(),(int)(string)1 /SlideSizeScaleType/);


See the results below:

How can I share the file with you? Your upload is limited to images and PDFs. They are private files.

Aspose.Slides for Java 19.4
1st try: Cloning time: 160 seconds
2nd try: Cloning time: 135 seconds
3rd try: Cloning time: 119 seconds
4th try Cloning time: 140 seconds
5th try Cloning time: 125 second

Version Aspose.Slides for Java 16.8.0
1st try: Cloning time: 30 seconds
2nd try: Cloning time: 21 seconds
3rd try: Cloning time: 30 seconds
4th try Cloning time: 31 seconds
5th try Cloning time: 25 second



Thank you for sharing the statistics. I request you to please share the source presentation reproducing the issue. We will log the request in our issue tracking system to further investigate the cause of increased slide cloning time.

Hi - Back to my earlier query. How do you share pptx privately files on this platform? Only acceptable files are images and PDFs.



You can zip the files and may upload in the forums if they are less than 3 MB. Otherwise, you may upload on some file server or Dropbox and share download link with us.


I have found the attachments shared by you in following forum thread and have responded to your inquiry.


1 Like