Merge PPTX Files in PHP
Combine PPTX presentations with Aspose.Slides for PHP via Java without requiring Microsoft PowerPoint.
Merge PPTX files using PHP
To merge PPTX presentations, load both files, clone each source slide into the destination presentation, and save the result in PPTX format.
PHP code for merging multiple PPTX files
$destinationPresentation = new Presentation("document1.pptx");
$sourcePresentation = new Presentation("document2.pptx");
try {
$slideCount = java_values($sourcePresentation->getSlides()->size());
for ($slideIndex = 0; $slideIndex < $slideCount; $slideIndex++) {
$slide = $sourcePresentation->getSlides()->get_Item($slideIndex);
$destinationPresentation->getSlides()->addClone($slide);
}
$destinationPresentation->save("merged.pptx", SaveFormat::Pptx);
} finally {
$sourcePresentation->dispose();
$destinationPresentation->dispose();
}Merge PPTX in PHP
Aspose.Slides for PHP via Java can combine multiple PPTX presentations into one file. The API clones slides from each source presentation into a destination presentation while retaining their content and formatting.
How to merge PPTX files in PHP
Follow these steps to merge two PPTX files and save the result as PPTX in PHP.
- Install Aspose.Slides for PHP via Java. See Installation.
- Configure Aspose.Slides in your PHP project.
- Load the source and destination PPTX files with the
Presentationclass, then clone each source slide withaddClone. - Call
savewith the output file path andSaveFormat::Pptx.
Built with Aspose.Slides
Merge PPTX Files Online
The free Aspose.Slides Merger app is built with Aspose.Slides for PHP via Java, the same API as the code above. Open it and see what the API can do with your own PPTX files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides merges files before you write code.
- Upload several PPTX files and combine them into one.
- Download the merged result as one file.
Merge PPTX with Other Supported Formats
You can also combine PPTX with presentations in other supported formats.