# Convert Image to PDF in PHP

> Convert an image to PDF in PHP with Aspose.Slides for PHP via Java.

Source: https://products.aspose.com/slides/php-java/conversion/image-to-pdf/
Updated: 2026-07-31



## Convert Image to PDF in PHP

[**Aspose.Slides for PHP via Java**](/slides/php-java/) lets you place an image on a presentation slide at its original dimensions and export the result as a PDF document.

Aspose.Slides supports common raster and vector image formats and can export image-based slides to PDF, PowerPoint, HTML, and other supported formats.

## Convert Image to PDF using PHP

To convert an image to PDF, create a `Presentation`, add the image with `addPictureFrame`, and call `save` with `SaveFormat::Pdf`.

### PHP code for converting Image into PDF

```php
$presentation = new Presentation();
try {
    $slide = $presentation->getSlides()->get_Item(0);

    $sourceImage = Images::fromFile("input.png");
    try {
        $embeddedImage = $presentation->getImages()->addImage($sourceImage);
    } finally {
        $sourceImage->dispose();
    }

    $imageWidth = java_values($embeddedImage->getWidth());
    $imageHeight = java_values($embeddedImage->getHeight());

    $slide->getShapes()->addPictureFrame(
        ShapeType::Rectangle, 0, 0, $imageWidth, $imageHeight, $embeddedImage);

    $presentation->save("output.pdf", SaveFormat::Pdf);
} finally {
    $presentation->dispose();
}
```

## How to convert Image to PDF using Aspose.Slides for PHP API

These are the steps to convert Image to PDF in PHP.

Install [**Aspose.Slides for PHP via Java**](/slides/php-java/).

Configure Aspose.Slides in your PHP project.

Load the source image with `Images::fromFile` and add it to the presentation image collection.

Add the image to the slide with `addPictureFrame`, then save with `SaveFormat::Pdf`.

## Convert Image To Other Supported Formats
