RedactArea.vb
- ''
- '' This code is part of Document Solutions for PDF demos.
- '' Copyright (c) MESCIUS inc. All rights reserved.
- ''
- Imports System.IO
- Imports System.Drawing
- Imports System.Text.RegularExpressions
- Imports GrapeCity.Documents.Pdf
- Imports GrapeCity.Documents.Pdf.Annotations
- Imports GrapeCity.Documents.Pdf.TextMap
- Imports GrapeCity.Documents.Pdf.AcroForms
-
- '' This sample demonstrates the use of GcPdfDocument.Redact() method.
- '' It loads the PDF generated by the SlidePages sample, creates
- '' a redact annotation on the first page, and applies it.
- Public Class RedactArea
- Function CreatePDF(ByVal stream As Stream) As Integer
- Dim doc = New GcPdfDocument()
- Using fs = New FileStream(Path.Combine("Resources", "PDFs", "SlidePages.pdf"), FileMode.Open, FileAccess.Read)
- '' Load the PDF containing redact annotations (areas marked for redaction):
- doc.Load(fs)
-
- Dim rc = New RectangleF(16, 16, 280, 300)
-
- Dim redact = New RedactAnnotation() With
- {
- .Rect = rc,
- .Page = doc.Pages(0),
- .OverlayText = "This content has been redacted.",
- .OverlayFillColor = Color.PaleGoldenrod
- }
-
- '' Apply the redact
- doc.Redact(redact)
-
- '' doc.Pages(0).Graphics.DrawRectangle(rc, Color.Red)
-
- '' Done
- doc.Save(stream)
- Return doc.Pages.Count
- End Using
- End Function
- End Class
-