I'm involved in a console application that convert from image jpg to pdf. Firstly, i need to an image to pdf converter. To do this I turned to iTextSharp. As we all know, iTextSharp is an open source for developers to use. But it is far too complex for my conversion needs. So, be clearly about your requirement and choose a suitable solution. For normal usage, there are a lot of solutions on Google and you will guided to how to do common things.

This article on XsPDF.com is what you looking for, check out: JPG to PDF Converter in C#

Answers

I'm involved in a console application that convert from image jpg to pdf. Firstly, i need to an image to pdf converter. To do this I turned to iTextSharp. As we all know, iTextSharp is an open source for developers to use. But it is far too complex for my conversion needs. So, be clearly about your requirement and choose a suitable solution. For normal usage, there are a lot of solutions on Google and you will guided to how to do common things.


Can not agree more! iTextSharp is not a totally free library. iTextSharp uses the AGPL license, so that you will need to pay the license fee or make your own code open source. For image conversion to PDF, like jpg, tiff, png, etc, we have a great trust with XsPDF. We use it to convert tiff to PDF for daily medical claims.


If you're looking for a library that can be used free testing or considering use it for commercial usage. XsPDF SDK is what a good choice. It provide an API for converting images (like jpg, png, tiff, bmp, tiff) to PDF.

The following is an example of creating PDF from given images.

// Import a list of images from local file, support jpeg, png, tif, bmp and gif
List<Image> images = new List<Image>();
images.Add(Image.FromFile("Test.bmp"));
images.Add(Image.FromFile("Test.png"));
images.Add(Image.FromFile("Test.gif"));
images.Add(Image.FromFile("Test.jpg"));
images.Add(Image.FromFile("Test.tiff"));

// Bacth convert images to pdf document, all the images will be drawn in input order.
// Mix image formats (combine single page image and multi-page tiff) to PDF is supported.
PdfDocument document = PdfDocument.ConvertToPdf(images);

// Save and show the document
document.Save("FromImage.pdf");
Process.Start("FromImage.pdf");