C# code tutorial

PDF Creating & Inserting PDF to Image PDF Digital Signature PDF Extracting PDF Processing & Editing PDF Protecting PDF Chart PDF Barcode

Popular .NET SDK

Developers can insert an image (digital photo, scanned signature or clipboard) into PDF document anywhere.

Quickly and easily add pictures to an existed PDF files without any other PDF readers. PDF .NET inserting control allows developers to insert images (support jpg, jpeg, png, tiff, tif, bmp and gif format) to a new PDF file or a created PDF document.

In this article, it shows how to insert image (can be from digital photo, scanned signature or clipboard) to PDF in C# program development. Developers can customize the adding image with rotation, scaling and zooming.

// Create a new PDF document.
PdfDocument document = new PdfDocument();

// Create an empty page in this document.
PdfPage page = document.AddPage();

// Obtain an XGraphics object to render to
XGraphics g = XGraphics.FromPdfPage(page);

// Load a local image file
XImage importImg = XImage.FromFile("image.jpg");

// Insert an image to pdf page, position and size can be modified
g.DrawImage(importImg, 50, 50, 200, 200);
// Save and show the document

More Excel tutorial