DeleteText.vb
C# VB
'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.IOImports GrapeCity.Documents.Pdf
Public Class DeleteText Public Function CreatePDF(ByVal stream As Stream) As Integer Dim doc = New GcPdfDocument() Using fs = File.OpenRead(Path.Combine("Resources", "PDFs", "TimeSheet.pdf")) doc.Load(fs)
' Delete dates and times using regex pattern: Dim ftps = New FindTextParams("\d+/\d+/\d+|\d+:\d+| am| pm", False, False, 72, 72, False, True) doc.DeleteText(ftps, GrapeCity.Documents.Pdf.TextMap.DeleteTextMode.PreserveSpace)
' For reference, append the original PDF: Util.AddNote("For reference, the following page contains a copy of the original unmodified PDF.", doc.NewPage()) Dim docOrig = New GcPdfDocument() docOrig.Load(fs) doc.MergeWithDocument(docOrig)
'' Done: doc.Save(stream) Return doc.Pages.Count End Using End FunctionEnd Class