//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Pdf; namespaceDsPdfWeb.Demos{// This example shows how to find and delete all occurrences of a text string in a PDF.publicclassDeleteText {publicintCreatePDF(Stream stream) {var doc = newGcPdfDocument();usingvar fs = File.OpenRead(Path.Combine("Resources", "PDFs", "TimeSheet.pdf")); doc.Load(fs); // Delete dates and times using regex pattern:var ftps = newFindTextParams(@"\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:Common.Util.AddNote("For reference, the following page contains a copy of the original unmodified PDF.", doc.NewPage());var docOrig = newGcPdfDocument(); docOrig.Load(fs); doc.MergeWithDocument(docOrig); // Done: doc.Save(stream);return doc.Pages.Count; } }}