Tech Specs
How-to C#
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print Work with Other SDKs Barcode Read Barcode Create OCR Twain

C# PDF Image Library
How to add, copy, paste existing PDF file images using C# .net

C# Guide for How to Cut or Copy an Image from One Page and Paste to Another One with C#.NET Demo Codes

  • Best .NET framework PDF editor SDK control for image copying, pasting and cutting from adobe PDF file in Visual C#
  • Free .NET components and SDK library able to copy, paste and cut image from PDF in C#.NET WinForms and ASP.NET project
  • Visual C# class source code for copying, pasting, cutting image from PDF in Visual Studio .NET framework program
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Ability to copy, paste and cut vector image, graphic picture, digital photo, scanned signature, logo, etc
  • High quality image can be saved after cutting, copying and pasting into PDF page in .NET console application
  • Guarantee high performance image processing by implementing coordinates to locate image position accurately
  • Empower to cut, copy and paste a single image, multiple images and whole PDF document images
  • Allow to copy an image from existing PDF file and paste it into another one
  • Easy to zoom and crop image for adjusting image size

Besides image extracting, adding, and removing, RasterEdge XDoc.PDF for .NET also supports image copying, pasting, and cutting.

Copy an image from a pdf file and paste to another position

This C#.NET example describes how to copy an image from one page of PDF document and paste it into another page.

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

PDFDocument doc = new PDFDocument(inputFilePath);

//  get the first page
int pageIndex = 0;
PDFPage page1 = (PDFPage)doc.GetPage(pageIndex);

//  select image at the position (480F, 550F) in the page
PointF cursorPos = new PointF(480F, 550F);
PDFImage image = PDFImageHandler.SelectImage(page1, cursorPos);

//  copy the image
Bitmap anImage = (Bitmap)image.Image.Clone();

//  get the second page
PDFPage page2 = (PDFPage)doc.GetPage(1);
//  set image position in the page: X = 100F, Y = 400F
PointF position = new PointF(100F, 400F);

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

//  output the new document

Move an image in the page

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

//  open a document and select the page
PDFDocument doc = new PDFDocument(inputFilePath);
PDFPage page = (PDFPage)doc.GetPage(0);
//  extract all images in the page
List<PDFImage> images = PDFImageHandler.ExtractImages(page);
//  move the first image to position (0, 0) in the same page
PDFImageHandler.MoveImageTo(doc, images[0], 0, new PointF(0F, 0F));

//  output the new document