Tech Specs
How-to C#
How-to VB.NET
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
Redact Images
Home ›› XDoc.PDF ›› C# PDF: Redact Images

C#.NET PDF SDK - Redact PDF Images in C#.NET

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

Look for HTML5 PDF Editor?

EdgePDF: ASP.NET PDF Editor is the best HTML5 PDF Editor and ASP.NET PDF Viewer based on XDoc.PDF, JQuery, HTML5. It supports ASP.NET MVC and WebForms projects.

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.

How to Erase PDF Images in .NET Using C# Class Code

Add necessary references:









Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

This C# coding example describes how to redact pdf images.

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