PM > Install-Package XDoc.PDF

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);








Common Asked Questions

How do you redact an image in PDF?

Most free or paid PDF editing applications support image redaction on a PDF file. For example, in Acrobat, you can redact image from a PDF using the following steps:
Open pdf file in Acrobat. Choose "Tools" > "Protect & Standardize" > "Redact" > "Mark for Redaction" > "Text and Images".

Using RasterEdge C# PDF component (dll) api, you can mark a specified area, and redact all images in the area from a PDF page in your C# ASP.NET Core, MVC web applications.

Can you redact an image in Adobe?

Yes. You can apply image redaction in Adobe Acrobat pro (paid version). If you want to redate images without any cost, you can use C# program to build a desktop or web tool to make image redaction using XDoc.PDF C# library.

How to redact in PDF without the redact tool?

You can remove the images from a PDF file, instead of redaction. Using C# PDF sdk api, you can easily enable image removing and/or redaction functions in your Visual Studio .NET projects.

How to remove graph lines from Adobe PDF?

You can remove graph lines from PDF directly or redate lines from the PDF using PDF editing programs. You can enable deleting PDF lines feature in your ASP.NET web or desktop tool using RasterEdge PDF C# library.

How do I black out a box in PDF?

You can remove the box from a PDF directly using PDF editing function, or apply redaction to black out the box in the PDF. Using C#.net PDF library, you can quickly add PDF content deleting and redaction functions to your ASP.NET webforms, MVC raster page.

How to Redact shapes in Adobe?

Using PDF editing application, such as Acrobat, you can redact PDF shapes from: "Tools" > "Protect & Standardize" > "Redact" > "Mark for Redaction" > "Text and Images". Select the PDF page area to redact shapes. Using C# PDF library, you can specifiy a rectangle area to make redaction, and apply the redaction to remove and redact all shapes inside in your C# applications.

How to remove a rectangle in Adobe Acrobat?

Same as redaction shapes in PDF document, you can specify the redaction area (rectangle) and apply redaction to remove a rectangle in Acrobat. Using C# PDF library, you can specify the redaction space, and the library will delete and redact all contents (including text, image, rectangle, and other shapes) from the PDF page in C# web and desktop applications.