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 Images
Home ›› XDoc.PDF ›› VB.NET PDF: Redact Images

VB.NET PDF - Redact PDF Images in VB.NET

Online VB.NET Guide for Redacting PDF Images to Protect Your PDF Document in Visual Basic .NET Application


Text content, images and PDF pages are all supported to be redacted with our .NET PDF SDK. after copy below demo code to your VB.NET project, you can call our image redaction API and quickly redact PDF images to protect confidential information inside the images. Same as text redaction, you can specify custom text to appear over the image redaction area.

How to VB.NET: Redact PDF Images

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 images.

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

' open document
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' get the 1st page
Dim page As PDFPage = doc.GetPage(0)

Dim images As List(Of PDFImage) = PDFImageHandler.ExtractImages(page)
If IsNothing(images) Or images.Count = 0 Then
    Return Nothing
End If

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

' redact the image in the page
PDFImageHandler.RedactImage(page, images(0), options)
' output file