This step-by-step tutorial shows you how to convert Image to PDF in C#. This example code helps you to quickly transform JPG image to PDF document with few lines of code. Further, you can easily convert Image to PDF using C# for other image formats such as PNG, TIFF, BMP, and many more.
Steps to Convert Image to PDF in C#
- Setup GroupDocs.Conversion for .NET from the NuGet to convert image to PDF using C#
- Add GroupDocs.Conversion namespace
- Create an instance of the Converter class and load the Image for conversion to PDF
- Create an instance of the PdfConvertOptions class
- Invoke the Convert method of the Converter class, provide the name for the PDF file and options for it
These steps cover everything you need to know about setting up the project and using the C# Image to PDF conversion functionality. To convert a JPG file to PDF, you must first install the needed library via the NuGet package manager. Finally, you may define settings for the converted PDF file and save it to the disk.
Code to Convert Image to PDF in C#
We have discussed in this tutorial how to do the conversion of Image to PDF in C#. Moreover, you can convert images to other document formats including Microsoft Word, Excel and Powerpoint formats. In this example, we have used JPG for the conversion to PDF and you can use other image formats such as PNG, BMP, GIF etc. for conversion.
If you want to convert PDF to Word in C# then refer to our other how to guide.