Images To PDF

This basic tutorial will teach you how to convert an image to PDF in C#. Following the steps outlined below and running the code snippet in your project, you can create a C# image-to-PDF conversion application. Furthermore, you do not need to install any other image processing software to use the image conversion feature.

There are numerous online and software tools now available for converting images to PDFs. Their numbers are growing by the day. The main reason for this is their widespread use. People frequently need to convert their images to PDFs for various reasons.

What is IronPDF?

The IronPDF .NET PDF Library helps developers create a .NET PDF processing application. IronPDF ensures that PDF conversions from different formats is easy and time-efficient. Developers can also use this library to create PDF files from HTML, JavaScript and CSS. It can easily edit documents to include additional text, graphics, and watermarks. It also makes it very easy to read PDF text, extract images, and convert images to PDF programmatically.

Convert JPG Images to PDF Formats

With IronPDF, you can convert JPG images to PDF files with a single line of code. IronPDF's ImageToPdf method can be used to complete this task. To convert any JPG image to a PDF document, use the System.IO.Directory to enumerate the folder containing the image, and pass it to the ImageToPDF method.


Combine multiple images into a PDF File

We can also convert images to PDFs in batch into a single PDF document using System.IO.Directory.EnumerateFiles along with ImageToPdfConverter.ImageToPdf, as shown below.

    string sourceDirectory = "D:\web\assets";
    string destinationFile = "JpgToPDF.pdf";
    var imageFiles = Directory.EnumerateFiles(sourceDirectory, "*.jpg");


In this tutorial, we learned a simple method for converting images to PDF files. We used code to demonstrate examples and converted a single image to a PDF. We've also combined several images into a single PDF document.

IronPDF is one of the available libraries included in Iron Software's IronSuite. The IronSuite also includes IronXL, IronBarode, IronOCR, and IronWebScraper. Purchase the entire IronSuite and save up to 250%. All five products are currently available for the price of just two of them.

PDF documents can be easily constructed from one or more image files using the IronPdf.ImageToPdfConverter Class.

You can download a file project from this link.