Merge Image to PDF in C#

Combine images into PDF documents with a cross-platform .NET API.

Merge Image to PDF using Aspose.Slides

Aspose.Slides for .NET lets you create, convert, merge, and manipulate presentations, PDFs, images, and other files. You can place images on slides and save the result as a single PDF document.

Merge Image to PDF in C#

Using Aspose.Slides for .NET , you can add images to a Presentation object and save the presentation with SaveFormat.Pdf.

C# code for merging Image to PDF

using var presentation = new Presentation();
presentation.Slides.RemoveAt(0);

var layoutSlide = presentation.LayoutSlides[0];

foreach (var imagePath in new[] { "image1.png", "image2.png" })
{
    var slide = presentation.Slides.AddEmptySlide(layoutSlide);

    var imageData = File.ReadAllBytes(imagePath);
    var presentationImage = presentation.Images.AddImage(imageData);
    slide.Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, 720, 540, presentationImage);
}

presentation.Save("merged.pdf", SaveFormat.Pdf);

How to merge Image to PDF in C#

  1. Install Aspose.Slides for .NET. See Installation .

  2. Add the library as a reference in your project.

  3. Create a Presentation object.

  4. Add each source image to a slide as a picture frame.

  5. Save the presentation with SaveFormat.Pdf.

Merge Images Online

Combine files online with Aspose.Slides Merger.

Merge other files

You can also combine files in other formats to get a single file