How to Start Tutorials Troubleshooting Main Operations Convert PDF Read PDF Edit PDF PDF Report Generator Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF Image Redact Library
How to redact or remove images from PDF file using c# in browser, winforms. Free Download


How to Redact PDF Images to Protect Your PDF Document in C# Using .NET PDF SDK





In this C# tutorial, you learn how to redact or remove sensitive image content from PDF files in C#.

How to redact, remove image content from existing PDF file using C#

  1. Download XDoc.PDF Image Redact C# library
  2. Install C# library to redact, remove images from PDF document
  3. Step by Step Tutorial








  • Best .NET PDF document manipulation SDK library for PDF image information protecting in C#.NET framework program
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Free trial components package for erasing PDF image in C#.NET WinForms and ASP.NET Web project
  • Free C# source code for quick evaluation in C#.NET class to darken selected image on adobe PDF document
  • A professional .NET control allows users to black out image in PDF document in Visual Studio C#.NET application
  • Enable users abilities to adjust color and transparency while scraping image from PDF file
  • Able to redact selected PDF image or all images in whole PDF file


You can quickly redact PDF images to protect confidential information inside the images. You can call our image redaction API to redact PDF images. Same as text redaction, you can specify custom text to appear over the image redaction area.





Redact an image in the page using c#


The C# sample code below explains how to redact an image from the PDF page using C#.

  • Create a PDFDocument object from an existing PDF file
  • Get a PDFImage object from the a PDF page
  • Set image redaction options through RedactionOptions object
  • Apply image redaction using methodPDFImageHandler..RedactImage()
  • Save the redacted PDF document



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
doc.Save(outputFilePath);




Redact contents in the given area of a page using c#


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

//  open file and get the first page
PDFDocument doc = new PDFDocument(inputFilePath);
int pageIndex = 0;
PDFPage page = (PDFPage)doc.GetPage(pageIndex);

//  set a redact area start from point (200, 300) with size (200, 150)
//  all value in pixels (96 dpi)
RectangleF redactArea = new RectangleF(200, 300, 200, 150);

//  use default redact options
RedactionOptions ops = new RedactionOptions();

//  apply redaction for the whole page
page.Redact(redactArea, ops);

doc.Save(outputFilePath);