Images To PDF

// Install IronPdf with Nuget: PM> Install-Package IronPdf
using IronPdf;
using System.IO;
using System.Linq;
// Select one or more images. This example selects all JPEG images in a specific folder.
var ImageFiles = Directory.EnumerateFiles(@"C:\project\assets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));
// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");
//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
' Install IronPdf with Nuget: PM> Install-Package IronPdf
Imports IronPdf
Imports System.IO
Imports System.Linq
' Select one or more images. This example selects all JPEG images in a specific folder.
Private ImageFiles = Directory.EnumerateFiles("C:\project\assets").Where(Function(f) f.EndsWith(".jpg") OrElse f.EndsWith(".jpeg"))
' Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs("C:\project\composite.pdf")
'Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
PDF documents can be easily constructed from one or more image files using the IronPdf.ImageToPdfConverter Class.