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 Text Content
Home ›› XDoc.PDF ›› C# PDF: Redact Text Content

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

C# Demo Code for Redacting PDF Text to Protect Your PDF Document in C#.NET Project

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 control for PDF text content protecting in Visual C#.NET project

Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint

Evaluation library and components for blanking out PDF text in C#.NET WinForms and ASP.NET WebForm application

Free online C# source code to erase text from adobe PDF file in Visual Studio. NET class without adobe reader installed

Provide a best and easy way to darken text in PDF document in C#.NET framework program

Enable users abilities to adjust color and transparency while scraping text from PDF file

Able to redact selected text in PDF document

Before you distribute a PDF, you may want to examine the document for sensitive content or private information that can trace the document to you. Call the Redact SDK API to remove or redact sensitive text that is visible in a PDF.

How to Use C# Code to Erase PDF Text in C#.NET

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 text content.

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

//  open document
PDFDocument doc = new PDFDocument(inputFilePath);
//  get the 3rd page
PDFPage page = (PDFPage)doc.GetPage(2);
//  set redact region
RectangleF region = new RectangleF(100F, 100F, 300F, 300F);

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

//  process redaction
PDFTextHandler.RedactText(page, region, options);
//  output file