Examples

Add Image to PDF (.NET Core/Framework)

Images can be added to a PDF easily using DynamicPDF Core Suite. Different image formats (GIF, JPEG, JPG, JPEG2000, PNG, BMP, EMF, EXIF, TIFF, Multi Page Tiff, TIFF to PDF, WMF and Transparent Images) can be added to a PDF document.

How to Add Image to PDF in C#

The following steps and sample code add an image to a PDF document using DynamicPDF Core Suite.

Steps for Adding an image to a PDF Document

  1. Create a Document object.
  2. Create a Page object and add to the Document instance.
  3. Create an Image object.
  4. Add the Image object to the Page instance.
  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");

How to Add Background Image to PDF in C#

Adding a background image to a PDF using DynamicPDF Core Suite is straightforward. Use the BackgroundImage class to place and stretch an image to the dimensions of a page. The following steps and sample code illustrate adding a Background Image to a PDF document using DynamicPDF Core Suite.

Steps for Adding Background Image to a PDF Document

  1. Create a Document object.
  2. Create a Page object and add it to the Document instance.
  3. Create a BackgroundImage object by specifying the image path.
  4. Place the image within the page margins.
  5. Add BackgroundImage instance to the Page instance.
  6. Save the PDF.

Sample Code - C#

Document document = new Document();
            
Page page = new Page();
document.Pages.Add(page);
            
BackgroundImage backgroundImage = new BackgroundImage(imagePath);
            
backgroundImage.UseMargins = true;
            
page.Elements.Add(backgroundImage);
            
document.Draw(@"C:\Output.pdf");

Getting Started

NuGet Package

The easiest way to install DynamicPDF Core Suite is by using the Visual Studio Package Manager. However, you can also download the NuGet package directly.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

For more information on DynamicPDF Core Suite, refer to the following web page.

Available on Other Platforms

The DynamicPDF Core Suite is also available for Java and COM/ActiveX. 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!