VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Redact Text Content
Home ›› XDoc.PDF ›› VB.NET PDF: Redact Text Content

VB.NET PDF - Redact PDF Text in VB.NET

Help VB.NET Users to Redact PDF Text to Protect PDF Document in VB.NET


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. RasterEdge XDoc.PDF SDK provides such functions to protect VB.NET users' personal information. This page will show you with VB.NET demo, by using this sample code, you can call the Redact SDK API to remove or redact sensitive text that is visible in a PDF.

Redact PDF Text using VB.NET

Add necessary references:









Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

This VB.NET coding example shows you how to redact PDF text content.

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

' open document
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' get the 3rd page
Dim page As PDFPage = doc.GetPage(2)
' set redact region
Dim region As RectangleF = New RectangleF(100.0F, 100.0F, 300.0F, 300.0F)

' create redaction option
Dim options As RedactionOptions = New RedactionOptions()
options.AreaFillColor = Color.Black

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