ApplyRedact.vb
  1. ''
  2. '' This code is part of Document Solutions for PDF demos.
  3. '' Copyright (c) MESCIUS inc. All rights reserved.
  4. ''
  5. Imports System.IO
  6. Imports System.Drawing
  7. Imports System.Text.RegularExpressions
  8. Imports GrapeCity.Documents.Pdf
  9. Imports GrapeCity.Documents.Pdf.Annotations
  10. Imports GrapeCity.Documents.Pdf.TextMap
  11. Imports GrapeCity.Documents.Pdf.AcroForms
  12.  
  13. '' This sample demonstrates the use of GcPdfDocument.Redact() method.
  14. '' It loads the PDF generated by the FindAndRedact sample, in which
  15. '' certain areas are marked for redaction, and applies those redacts.
  16. '' The original PDF without redact annotations is created by TimeSheet.
  17. Public Class ApplyRedact
  18. Function CreatePDF(ByVal stream As Stream) As Integer
  19. Dim doc = New GcPdfDocument()
  20. Using fs = New FileStream(Path.Combine("Resources", "PDFs", "find-and-redact.pdf"), FileMode.Open, FileAccess.Read)
  21. '' Load the PDF containing redact annotations (areas marked for redaction):
  22. doc.Load(fs)
  23.  
  24. '' Apply the redacts:
  25. doc.Redact()
  26.  
  27. '' Done
  28. doc.Save(stream)
  29. Return doc.Pages.Count
  30. End Using
  31. End Function
  32. End Class
  33.