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?
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
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"); ImageToPdfConverter.ImageToPdf(imageFiles).SaveAs(destinationFile);
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
You can download a file project from this link.