XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain

C# PDF Image Editor Library
How to add image (png) to existing PDF file using c# .net


How to Use XDoc.PDF SDK for .NET to Insert & Add Image, Picture or Logo on PDF Page in C#.NET










  • An advanced PDF image processing SDK library allows users to insert images to adobe PDF document in C#.NET Class
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Free evaluation components for inserting images to PDF file in Visual C# .NET WinForms and ASP.NET web application
  • Free online C# source code for PDF image adding in Visual Studio .NET framework program
  • Create high resolution PDF file without image quality losing .NET console application
  • Add multiple images to multipage PDF document in .NET WinForms
  • Support various image formats, like Jpeg or Jpg, Png, Gif, Bmp, Tiff and other bitmap images
  • Import graphic picture, digital photo, signature and logo into PDF document
  • Ability to put image into specified PDF page position and save existing PDF file or output a new PDF file
  • An independent .NET view control supports preview PDF in ASPX webpage
  • Able to zoom and crop image and achieve image resizing
  • Insert images into PDF form field


How to insert and add image, picture, digital photo, scanned signature or logo into PDF document page in C#.NET class application? To help you solve this technical problem, we provide this C#.NET PDF image adding control, XDoc.PDF for .NET.



Similar to other toolkits from RasterEdge.com, this C#.NET PDF image adding control is also completely developed in .NET developing platform and compatible with .NET Framework 2.0 and later versions. Using this C# .NET image adding library control for PDF document, you can easily and quickly add an image, picture or logo to any position of specified PDF document file page.







Add a Bitmap image to a PDF page with the specified position


String inputFilePath = Program.RootPath + "\\" + "1.pdf";
String outputFilePath = Program.RootPath + "\\" + "output.pdf";

//  load a sample image
Bitmap anImage = new Bitmap(Program.RootPath + "\\" + "1.png");

//  open the document
PDFDocument doc = new PDFDocument(inputFilePath);
//  get the first page
PDFPage page = (PDFPage)doc.GetPage(0);
//  set image position in the page: X = 100F, Y = 400F
PointF position = new PointF(100F, 400F);

//  add image to the page
PDFImageHandler.AddImage(page, anImage, position);

//  output the new document
doc.Save(outputFilePath);




Add a Bitmap image to a page with advanced settings


String inputFilePath = Program.RootPath + "\\" + "1.pdf";
String outputFilePath = Program.RootPath + "\\" + "output.pdf";

//  load a sample image
Bitmap anImage = new Bitmap(Program.RootPath + "\\" + "1.png");

//  set image item option
PDFItemOptions ops = new PDFItemOptions();
//  set image position in the page: X = 100F, Y = 400F (in pixel, 96dpi)
ops.Position = new PointF(100F, 400F);
//  add image over all page contents
ops.Level = DisplayLevel.Over;
//  set image actual width and height in the page
ops.Width = 192;        //  2 inches in width
ops.Height = 96;        //  1 inch in height
//  set compression mode for the image
ops.Compression = PDFCompression.DCTDecode;
//  set image quality level (only available for compression mode DCT)
ops.JPEGImageQualityLevel = JPEGImageQualityLevel.Medium;

//  open the document
PDFDocument doc = new PDFDocument(inputFilePath);
int pageIndex = 0;

//  add image to the target page
PDFImageHandler.AddImage(doc, pageIndex, anImage, ops);

//  output the new document
doc.Save(outputFilePath);