Merge JPG to PDF in C#

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

Merge JPG 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 JPG images on slides and save the result as a single PDF document.

Merge JPG to PDF in C#

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

C# code for merging JPG to PDF

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

var layoutSlide = presentation.LayoutSlides[0];

foreach (var imagePath in new[] { "image1.jpg", "image2.jpg" })
{
    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 JPG 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 JPG image to a slide as a picture frame.

  5. Save the presentation with SaveFormat.Pdf.

Merge JPG 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