ASPOSE.SLIDES FOR PHP VIA JAVA · ON-PREMISES LIBRARY · JVM-BACKED · NO OFFICE REQUIRED

PowerPoint files, from PHP.

Aspose.Slides for PHP via Java creates, edits, converts and renders PowerPoint and OpenDocument presentations from PHP. It is not a native extension: the Composer package aspose/slides is a thin PHP surface over the Java build, so the host needs a JRE and the PHP/Java Bridge running in a servlet container alongside PHP. What it does not need is a Microsoft Office install, COM automation or a display server.

Download free trial Documentation Full API on trial · watermark on output
Install
Composer
composer require aspose/slides
Bridge JAR
cp vendor/aspose/slides/jar/aspose-slides-*-php.jar $CATALINA_HOME/webapps/JavaBridge/WEB-INF/lib/
PHP wrapper
require_once("vendor/aspose/slides/lib/aspose.slides.php");
Other platforms, same object model
RUNS ON

Anywhere a Java runtime runs: Windows, Linux and macOS, 32-bit or 64-bit. You need PHP 7.0 or later with allow_url_include on, a JRE 8 or later with JAVA_HOME set, and the PHP/Java Bridge deployed as JavaBridge.war in a servlet container such as Tomcat, with the package’s aspose-slides JAR copied into JavaBridge/WEB-INF/lib. PHP 8 hosts swap in the Java.inc from Java.inc.php8.zip that ships in the package. Note that files are opened and written by the JVM, not by PHP, so relative paths resolve against the servlet container’s working directory - use absolute paths. Aspose’s reference container is Ubuntu 20.04 with OpenJDK 8, Tomcat 9 and php-cli, and carries no Microsoft Office and no X display.

Prefer not to host it yourself? The same work is available as a hosted REST API through Aspose.Slides Cloud.

  • 189 / 82

    Shape types and chart types, each a real object that PowerPoint still recognises and lets a person edit.

  • 13 -> 12

    Presentation formats read and written, including the pre-2007 binary .ppt container and OpenDocument .odp, plus 9 further export targets.

  • 1

    Composer package, aspose/slides. It wraps the Java build rather than replacing it, so it is not the only thing you install.

  • JRE 8+

    Java runtime with JAVA_HOME set, plus the PHP/Java Bridge in a servlet container. Still zero Microsoft Office installs and zero X displays.

Five things people actually write

All examples on GitHub →

Each sample is the whole program, PHP as shipped. Pick the job on the left.

PPTX -> PDF / HTML / TIFF PHP
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");

require_once("Java.inc");
require_once("vendor/aspose/slides/lib/aspose.slides.php");

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

$presentation = new Presentation("/srv/decks/quarterly-review.pptx");
try {
    $presentation->save("/srv/decks/quarterly-review.pdf", SaveFormat::Pdf);
    $presentation->save("/srv/decks/quarterly-review.html", SaveFormat::Html);
    $presentation->save("/srv/decks/quarterly-review.tiff", SaveFormat::Tiff);
} finally {
    $presentation->dispose();
}
One save call per target, and no options object needed for sane defaults. SaveFormat also carries XPS, Markdown, GIF and the OpenDocument containers. Documentation →
Slide -> PNG at 1200 x 800 PHP
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");

require_once("Java.inc");
require_once("vendor/aspose/slides/lib/aspose.slides.php");

use aspose\slides\ImageFormat;
use aspose\slides\Presentation;

$size = new Java("java.awt.Dimension", 1200, 800);

$presentation = new Presentation("/srv/decks/quarterly-review.pptx");
try {
    $slides = $presentation->getSlides();

    for ($i = 0; $i < java_values($slides->size()); $i++) {
        $image = $slides->get_Item($i)->getImage($size);
        try {
            $image->save("/srv/decks/slide-" . ($i + 1) . ".png", ImageFormat::Png);
        } finally {
            $image->dispose();
        }
    }
} finally {
    $presentation->dispose();
}
getImage returns an image object you dispose yourself. Pass a scale factor instead of a Dimension to render relative to the slide size. Documentation →
PHP array -> ClusteredColumn chart PHP
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");

require_once("Java.inc");
require_once("vendor/aspose/slides/lib/aspose.slides.php");

use aspose\slides\ChartType;
use aspose\slides\Presentation;
use aspose\slides\SaveFormat;

$data = ["Q1" => 120, "Q2" => 145, "Q3" => 132, "Q4" => 168];

$presentation = new Presentation();
try {
    $slide = $presentation->getSlides()->get_Item(0);
    $chart = $slide->getShapes()->addChart(ChartType::ClusteredColumn, 50, 50, 600, 400);

    $chartData = $chart->getChartData();
    $workbook = $chartData->getChartDataWorkbook();
    $sheet = 0;

    $chartData->getSeries()->clear();
    $chartData->getCategories()->clear();
    $chartData->getSeries()->add($workbook->getCell($sheet, 0, 1, "Signups"), $chart->getType());

    $series = $chartData->getSeries()->get_Item(0);
    $row = 1;

    foreach ($data as $quarter => $value) {
        $chartData->getCategories()->add($workbook->getCell($sheet, $row, 0, $quarter));
        $series->getDataPoints()->addDataPointForBarSeries($workbook->getCell($sheet, $row, 1, $value));
        $row++;
    }

    $presentation->save("/srv/decks/signups-by-quarter.pptx", SaveFormat::Pptx);
} finally {
    $presentation->dispose();
}
Values land in the chart's embedded workbook, so PowerPoint opens a live data sheet rather than a flat picture. Documentation →
PPTX -> encrypted PPTX PHP
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");

require_once("Java.inc");
require_once("vendor/aspose/slides/lib/aspose.slides.php");

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

$presentation = new Presentation("/srv/decks/quarterly-review.pptx");
try {
    $protection = $presentation->getProtectionManager();
    $protection->setWriteProtection("edit-password");
    $protection->encrypt("open-password");

    $presentation->save("/srv/decks/quarterly-review-protected.pptx", SaveFormat::Pptx);
} finally {
    $presentation->dispose();
}
encrypt sets the password needed to open the file. setWriteProtection sets a separate one needed to change it; the two are independent. Documentation →
3 x PPTX -> 1 PPTX PHP
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/JavaBridge/servlet.phpjavabridge");

require_once("Java.inc");
require_once("vendor/aspose/slides/lib/aspose.slides.php");

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

$parts = ["/srv/decks/intro.pptx", "/srv/decks/results.pptx", "/srv/decks/roadmap.pptx"];

$merged = new Presentation($parts[0]);
try {
    $master = $merged->getMasters()->get_Item(0);

    for ($i = 1; $i < count($parts); $i++) {
        $source = new Presentation($parts[$i]);
        try {
            $slides = $source->getSlides();

            for ($j = 0; $j < java_values($slides->size()); $j++) {
                $merged->getSlides()->addClone($slides->get_Item($j), $master, true);
            }
        } finally {
            $source->dispose();
        }
    }

    $merged->save("/srv/decks/merged.pptx", SaveFormat::Pptx);
} finally {
    $merged->dispose();
}
Pass the destination master to addClone and the result carries one master instead of three. Loop by index: slide collections are Java objects and do not support PHP foreach. Documentation →

What goes in, what comes out

Read in only

Other content read inplaced into a presentation rather than opened as one

  • HTML
  • PDF
  • raster image

Read onlyno writer in the API

  • PPT95

Aspose.Slides

12 formats read and written — the presentation formats this library opens and saves.

  • FODP
  • ODP
  • OTP
  • POT
  • POTM
  • POTX
  • PPS
  • PPSM
  • PPSX
  • PPT
  • PPTM
  • PPTX

Written out only

Written onlyexport targets, not presentation files

  • GIF
  • HTML
  • HTML5
  • MD
  • PDF
  • SWF
  • TIFF
  • XML
  • XPS

Slide imagesrendered from a slide

  • BMP
  • EMF
  • GIF
  • JPEG
  • PNG
  • SVG
  • TIFF

Capabilities, one line each

Everything the Java engine does is reachable from PHP - shapes, tables, charts, SmartArt, animations, speaker notes, comments, sections and every export target in the JAR - so long as you remember that each value handed back is a Java object rather than a PHP one.

File formats
  • Reads OOXML presentations
  • Writes .pptx
  • Reads legacy binary PowerPoint
  • Writes legacy binary .ppt
  • Reads OpenDocument presentations
  • Writes .odp
  • Exports to PDF
  • Imports PDF into a presentation
  • Exports slides to raster images
  • Exports to HTML
  • Extracts text / Markdown / JSON
Deployment
  • Runs entirely on the customer's own infrastructure
  • Offered as a hosted API the customer calls — through Aspose.Slides Cloud, a separate product
  • Runs without a Microsoft Office / LibreOffice installation
  • Works with no outbound network access
Document operations
  • Create from nothing
  • Open, modify, save back
  • Preserve untouched content
  • Merge or append presentations
  • Slide thumbnails
  • Create charts
Non-functional
  • Published performance numbers — one published capacity figure, no benchmark suite
  • Air-gapped install and licensing
API & language reach
  • .NET · Java / JVM · Python · C / C++
  • JavaScript / TypeScript / Node · PHP
  • Android, SharePoint and JasperReports integrations
  • Language-agnostic REST/HTTP API — through Aspose.Slides Cloud, a separate product
Ecosystem & support
  • Public API reference and guides
  • Runnable sample projects
  • Paid support and escalation

Runs where your code already runs

Where a build of this library is supported, and what each target is for.

  • .NET

    Native managed library, one NuGet package, no JVM anywhere in the stack.

    WINDOWS · LINUX · MACOS

  • Java

    The engine this package wraps. Call it directly and the bridge disappears.

    WINDOWS · LINUX · MACOS

  • Node.js via Java

    The closest sibling to this build: same JAR, same object model, a JavaScript surface.

    WINDOWS · LINUX · MACOS

  • Python via .NET

    Same object model over the .NET build, so it asks for no Java runtime at all.

    WINDOWS · LINUX · MACOS

  • C++

    Native code, no managed runtime and no JVM to provision or tune.

    WINDOWS · LINUX · MACOS

The same object model ships for .NET, Java, C++, Python, Node.js and Android, so moving a deck pipeline between runtimes is renaming, not rewriting.All high-code APIs →

Start with the trial, license when you ship

The trial is the full API. It applies an evaluation watermark when a presentation is opened or saved and replaces extracted text with an evaluation notice, so you can test the formats you actually care about before you talk to anyone. A temporary licence lifts both for 30 days.

If you don't want a library

Aspose.Slides Cloud is a hosted REST API for loading, creating, editing and converting presentations.

In use

The product worked as advertised, the documentation was easy to follow, and the support forums were all the help we needed. The final solution that we deployed has exceeded our initial expectations by a great deal.

— BRUCE BRIEN · STRATASCOPE INC, USA

ASPOSE.SLIDES FOR PHP VIA JAVA · PRODUCTS.ASPOSE.COMPRESENTATION AUTOMATION WITHOUT MICROSOFT OFFICE