'' This code is part of GrapeCity Documents for PDF samples.
'' Copyright (c) GrapeCity, 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):

            '' Apply the redacts:

            '' Done
            Return doc.Pages.Count
        End Using
    End Function
End Class