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 Redaction Library
How to redact or remove Adobe PDF file pages using c#, in web browser, windows WinForms, WPF


How to Redact the Whole PDF Pages in Visual C# Class with .NET PDF Component





In this tutorial, you learn how to redact or remove PDF pages usings C#.

How to redact pages from existing PDF file using C#

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








  • A best .NET PDF document manipulation SDK control for Visual Studio .NET can help to protect adobe PDF file with redaction functionalities using C#
  • Free online C# source code to darken pages from adobe PDF file in Visual C#. NET program without adobe reader installed
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Free evaluation library and components for erasing PDF page in all C#.NET WinForms application
  • Able to black out PDF page online in ASP.NET WebForm application
  • Support to adjust color and transparency while scraping text from PDF file in .NET framework
  • Able to redact a range of selected pages in PDF document
  • Support to redact whole PDF pages in Visual Studio .NET


Redaction is the process of permanently removing visible text and graphics from a document. You can call our redact function API to redact entire PDF pages. You can specify custom text to appear over the redaction area.





Redact the whole pdf page using c#


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

  • Create a PDFDocument object from an existing PDF file
  • Select the target PDF page, and get PDFPage object.
  • Set page redaction options through RedactionOptions object
  • Apply page redaction using method Redact() from PDFPage
  • Save the redacted PDF file



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

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

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

//  redact the whole page
page.Redact(options);
//  output file
doc.Save(outputFilePath);








Common Asked Questions

How do I Redact a whole page in PDF?

Using Acrobat, open the PDF file, choose "Tools" > "Protect & Standardize" > "Redact" > "Mark for Redaction" > "Pages". In the "Mark Page Range" dialog, select the PDF page or pages to mark for redaction. Using C# PDF library, you can specify one page, or mutliple continuous or discontinuous pages list to mark for redaction, and apply pages redaction in your C# class, console, Windows Forms, WPF and ASP.NET applications.

How do I black out part of a PDF document?

Using PDF editing program, you can redact one or more rectangle areas in a page, or one or multiple pages from a PDF document. Using C# PDF SDK, you can easily build a web or Windows application with the same redaction functions as Acrobat on Windows.

How to Redact in PDF without the Redact tool?

To remove sensitive content from a PDF file, you can redact content or remove them directly from the PDF file. Using RasterEdge C# PDF editing library, you both apply content redaction and deleting functions in your .NET applications.

How to Redact multiple pages at once?

In Acrobat, you can redact the current page or specify the page range for redaction. Using C# PDF library, you can redact one or multiple pages (continuous or discontinuous) from a PDF document in C# Visual Studio .NET projects.