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 Editor Library
How to add, remove, delete images from existing PDF file using C# .net

.NET PDF SDK Provides C# Demo Code for Deleting and Removing Image from PDF File Page

  • A best C#.NET PDF image editor control able to delete images from adobe PDF document in Visual Studio .NET framework project
  • Free evaluation SDK library for PDF image deletion in .NET WinForms and ASP.NET program
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • C#.NET class source code are accessible for removing PDF pages in .NET console application
  • Support removing vector image, graphic picture, digital photo, scanned signature, logo, etc
  • Get all image objects and remove multiple or all images from PDF document
  • Delete and remove all image objects contained in a specific PDF page
  • Define position to remove a specified image from PDF document page

RasterEdge XDoc.PDF for .NET provides C# developers with various methods to obtain and delete image objects included in Adobe PDF document. Generally speaking, using well-designed APIs, C# developers can do following things.

Delete all images in the PDF file using c#

This complete C# example shows how to extract all images and delete them all from PDF document.

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

//  open the document
PDFDocument doc = new PDFDocument(inputFilePath);
//  extract all images from the document
List<PDFImage> allImages = PDFImageHandler.ExtractImages(doc);
//  delete all images from the document
foreach (PDFImage image in allImages)
    PDFImageHandler.DeleteImage(doc, image);

//  output the new document

Redact, delete an image in the page using c#

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

//  open document
PDFDocument doc = new PDFDocument(inputFilePath);
//  get the 1st page
PDFPage page = (PDFPage)doc.GetPage(0);

List<PDFImage> images = PDFImageHandler.ExtractImages(page);
if (images == null || images.Count == 0) return;

//  create redaction option
RedactionOptions options = new RedactionOptions();
options.AreaFillColor = Color.LightGray;

//  redact the image in the page
PDFImageHandler.RedactImage(page, images[0], options);
//  output file