The Syncfusion Essential PDF is a .NET PDF library that allows you to convert an image file into a PDF file. Convert various image formats such as Bitmap, JPEG, GIF, PNG, TIFF, ICO, and ICON to PDF using NET Core or VB.NET.
The Image to PDF feature works seamlessly on various platforms: WinForms, WPF, Blazor, ASP.NET MVC, ASP.NET Core, UWP, Xamarin with Windows, Linux, and MacOS.
Here is an example of how to convert an image to a PDF document in C# using the Syncfusion PDF library. You can convert an image to a PDF document with just a few lines of code.
//Create an instance of the ImageToPdfConverter class from Syncfusion
ImageToPdfConverter imageToPdfConverter = new ImageToPdfConverter();
//Set the page size for the PDF
imageToPdfConverter.PageSize = PdfPageSize.A4;
//Set the position of the image in the PDF
imageToPdfConverter.ImagePosition = PdfImagePosition.TopLeftCornerOfPage;
//Specify the file path of the image to be converted to PDF
var imageFile = Path.Combine("Autumn Leaves.jpg");
//Create a file stream to read the image file
FileStream stream = new FileStream(imageFile, FileMode.Open, FileAccess.Read);
//Convert the image to a PDF document using the ImageToPdfConverter
PdfDocument document = imageToPdfConverter.Convert(stream);
//Create a file stream for the output PDF file
using (FileStream outputFileStream = new FileStream(Path.GetFullPath("Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the generated PDF document to the output file stream
document.Save(outputFileStream);
}
//Close the document.
document.Close(true);
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.