We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Trusted by the world’s leading companies

Overview

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.


How to convert Images to PDF Files in C#

  1. Install the Syncfusion.Pdf.Imaging.Net.Core NuGet package to your project.
  2. Create an object for ImageToPdfConverter class and set the page size.
  3. Create a file stream to read the image file.
  4. Convert the image to a PDF document using the ImageToPdfConverter.
  5. Save the PdfDocument object to the FileStream object.

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);




Awards

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.

Scroll up icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon