Aspose.Slides  for PHP via Java

PHP PowerPoint API for Presentations. PHP Presentation, PPT, PPTX, ODP

Create, read, write, modify, merge, clone, protect & convert PowerPoint and OpenOffice presentations in PHP without any external software.

  Download Free Trial
  
 

Aspose.Slides for PHP via Java is a powerful class library for working with or processing presentations. Using this product, applications and developers get to read, edit or manipulate, and convert PowerPoint presentations (PPT, PPTX) and presentations in other formats (ODP) without third-party applications or dependencies.

Aspose.Slides for PHP via Java provides these popular features:

  • Loading, opening, and viewing presentations.
  • Editing presentations.
  • Converting presentations to PDF, Word, JPG, HTML, GIF, SVG, and many other formats.
  • Rendering and printing presentations.
  • Encrypting and decrypting presentations; password-protecting presentations and removing passwords.
  • Manipulating presentation entities, such as master slides, shapes, charts, picture frames, audio frames, video frames, OLE, VBA macros, animations, etc.
  • And many more features.

PHP is a popular general-purpose scripting language, especially for web development purposes. For this reason, the Aspose.Slides team is proud to offer Aspose.Slides for PHP via Java to the PHP community.

Advanced PHP PowerPoint API Features

Create or clone slides from templates

Work with PowerPoint tables via API

Apply or remove the protection on shapes

Add Excel charts as OleObjects to slides

Support for Linked OleObjects

Generate presentations from database

Protect presentations & resultant PDF

Print presentations on a physical printer

Create & customize charts

System Requirements

  • Compatible with PHP 7 or later

How to Install

Use packagist to install our PHP library for Presentation processing from the PHP Package repository:

composer require aspose/slides

Create New PowerPoint Presentation. PHP Presentation: PPT, PPTX, ODP

In the example given below, we have added a line to the first slide of the presentation.

            	
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");

use aspose\slides;
use aspose\slides\Presentation;
use aspose\slides\ShapeType;
use aspose\slides\SaveFormat;

$pres = new Presentation();
try
{
    // Gets the first slide
    $slide = $pres->getSlides()->get_Item(0);
    // Adds an autoshape with type set to line
    $slide->getShapes()->addAutoShape(ShapeType::Line, 50, 150, 300, 0);
    $pres->save("NewPresentation_out.pptx", SaveFormat::Pptx);
}
finally
{
    if ($pres != null) $pres->dispose();
}
            
        

Merge Presentations. PHP Presentation: PPT, PPTX, ODP

This PHP code shows you how to merge presentations:

            
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");

use aspose\slides;
use aspose\slides\Presentation;
use aspose\slides\ShapeType;
use aspose\slides\SaveFormat;

$pres1 = new Presentation("pres1.pptx");
$pres2 = new Presentation("pres2.pptx");
try
{
	for ($i = 0; $i < java_values($pres2->getSlides()->size()); $i++) 
	{
		$pres1->getSlides()->addClone($pres2->getSlides()->get_Item($i));
	}
	$pres1->save("combined.pptx", SaveFormat::Pptx);
}
finally
{
    if ($pres1 != null) $pres1->dispose();
	if ($pres2 != null) $pres2->dispose();
}
            
        

Import Presentation From PDF. PHP Presentation: PDF to PPT, PDF to PPTX, PDF to ODP

This PHP code demonstrates the PDF to PowerPoint conversion process:

            
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");

use aspose\slides;
use aspose\slides\Presentation;
use aspose\slides\ShapeType;
use aspose\slides\SaveFormat;

$pres = new Presentation();
try
{
    $pres->getSlides()->removeAt(0);
    $pres->getSlides()->addFromPdf("welcome-to-powerpoint.pdf");
    $pres->save("OutputPresentation.pptx", SaveFormat::Pptx);
}
finally
{
    if ($pres != null) $pres->dispose();
}
            
        

Convert PowerPoint to PDF with Default Options: PHP Presentation, PPT, PPTX or ODP to PDF

This PHP code shows you how to convert a PowerPoint PPT, PPTX, and OpenOffice ODP document to a PDF document using the default options. The resulting file is a PDF document at the maximum quality levels

            
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");

use aspose\slides;
use aspose\slides\Presentation;
use aspose\slides\ShapeType;
use aspose\slides\SaveFormat;

// Instantiate a Presentation object that represents a PPT file
$pres = new Presentation("PowerPoint.ppt");
try
{
    // Save the presentation as PDF
    $pres->save("PPT-to-PDF.pdf", SaveFormat::Pdf);
}
finally
{
    if ($pres != null) $pres->dispose();
}
            
        

Convert PowerPoint to JPG. PHP Presentation. PPT to JPG, PPTX to JPG, ODP to JPG

The following example shows you how to convert a PowerPoint PPT, PPTX, and OpenOffice ODP document into a set of JPEG images.

            
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");

use aspose\slides;
use aspose\slides\Presentation;
use aspose\slides\ShapeType;
use aspose\slides\SaveFormat;

// Instantiate a Presentation object that represents a PPT file
$pres = new Presentation("pres.pptx");
try
{
    for ($i = 0; $i < java_values($pres->getSlides()->size()); $i++)
    {
        $bmp = $pres->getSlides()->get_Item($i)->getThumbnail(1, 1);
		$imageio = new Java("javax.imageio.ImageIO");
		$javafile = new Java("java.io.File", "slide_". $i .".jpg");
		$imageio->write($bmp, "JPEG", $javafile);
	}
}
finally
{
    if ($pres != null) $pres->dispose();
}
            
        

What People Are Saying

Don't just take our word for it. See what users have to say about PowerPoint APIs.

 
 
View Case Studies
  

Support and Learning Resources