Merge TIFF Images to PDF in PHP

Place multiple TIFF images on separate slides and export them as a single PDF document with Aspose.Slides for PHP via Java.

Merge TIFF to PDF in PHP

Load each TIFF file with Images::fromFile, add a slide with addEmptySlide, place the image with addPictureFrame, and call save with SaveFormat::Pdf.

PHP code for merging TIFF images into PDF

$presentation = new Presentation();
try {
    $presentation->getSlides()->removeAt(0);
    $layoutSlide = $presentation->getLayoutSlides()->get_Item(0);

    $imagePaths = ["image1.tiff", "image2.tiff"];
    foreach ($imagePaths as $imagePath) {
        $slide = $presentation->getSlides()->addEmptySlide($layoutSlide);

        $sourceImage = Images::fromFile($imagePath);
        try {
            $presentationImage = $presentation->getImages()->addImage($sourceImage);
        } finally {
            $sourceImage->dispose();
        }

        $slide->getShapes()->addPictureFrame(
            ShapeType::Rectangle, 0, 0, 720, 540, $presentationImage);
    }

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

Merge TIFF to PDF using Aspose.Slides

Aspose.Slides for PHP via Java lets you place each TIFF image on a separate presentation slide and export all the slides as a single multi-page PDF document.

How to merge TIFF images to PDF in PHP

  1. Install Aspose.Slides for PHP via Java. See Installation.
  2. Configure Aspose.Slides in your PHP project.
  3. Create a Presentation, remove its default slide, and access a layout slide.
  4. Load each TIFF file with Images::fromFile, add an empty slide with addEmptySlide, and place the image with addPictureFrame.
  5. Save the presentation with SaveFormat::Pdf.

Built with Aspose.Slides

Merge TIFF to PDF 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 TIFF files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides merges files before you write code.
  • Upload several TIFF files and combine them into one PDF file.
  • Download the merged result as one file.

Merge Other Files

You can also combine files in other supported formats.