''
'' 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 FindAndRedact sample, in which
'' certain areas are marked for redaction, and applies those redacts.
'' The original PDF without redact annotations is created by TimeSheet.
Public Class ApplyRedact
Function CreatePDF(ByVal stream As Stream) As Integer
Dim doc = New GcPdfDocument()
Using fs = New FileStream(Path.Combine("Resources", "PDFs", "find-and-redact.pdf"), FileMode.Open, FileAccess.Read)
'' Load the PDF containing redact annotations (areas marked for redaction):
doc.Load(fs)
'' Apply the redacts:
doc.Redact()
'' Done
doc.Save(stream)
Return doc.Pages.Count
End Using
End Function
End Class