Add Image to PDF in C#

Image can be added to a PDF easily using the DynamicPDF Generator product. Different image formats (GIF, JPEG, JPEG 2000, PNG, BMP, EMF, EXIF, TIFF, Multi Page TIFF, WMF etc) can be added to a PDF document.

How to add an Image to PDF in C#

Below are the steps and sample code to add an image to PDF document using the Generator product.

Steps for adding an image to PDF Document

  1. Create a Document object.
  2. Create and add a Page to the document.
  3. Create an Image object.
  4. Add the image to the page.
  5. Save the PDF document.

Sample Code - C#

Document document = new Document();
 
Page page = new Page();
document.Pages.Add(page);
 
Image image = new Image(@"C:\MyImage.jpg", 0, 0);
page.Elements.Add(image);
 
document.Draw(@"C:\MyDocument.pdf");

Getting Started

NuGet Package

DynamicPDF Generator is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite package includes Generator, Merger and ReportWriter.

Nuget Logo
NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

Example Project

An example project showing this functionality can be cloned or viewed from GitHub:

GitHub Logo
Clone or View Example Project on GitHub

DynamicPDF Generator Information

More information can be found here:

Available in Other Platforms

Generator Libraries are available for Java and COM/AxtiveX platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!