//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Pdf;usingGrapeCity.Documents.Pdf.Annotations;usingSystem.Collections.Generic;usingGrapeCity.Documents.Common; namespaceDsPdfWeb.Demos{// This example shows how to find all occurrences of two words in a PDF document and// underline those occurrences using the text markup underline annotation.publicclassFindAndUnderline {publicintCreatePDF(Stream stream) {// Load the PDF:var doc = newGcPdfDocument();usingvar fs = File.OpenRead(Path.Combine("Resources", "PDFs", "The-Rich-History-of-JavaScript.pdf")); doc.Load(fs); // Find all occurrences of "JavaScript" or "ECMAScript" using regex:var ft = newFindTextParams("JavaScript|ECMAScript", wholeWord: false, matchCase: false, regex: true);var found = doc.FindText(ft, null); // Add a text markup annotation to underline each occurrence:foreach (var f in found) {var markup = newTextMarkupAnnotation() {Page = doc.Pages[f.PageIndex],MarkupType = TextMarkupType.Underline,Color = Color.Red };List<Quadrilateral> area = newList<Quadrilateral>();foreach (var b in f.Bounds) area.Add(b); markup.Area = area; } // Done: doc.Save(stream);return doc.Pages.Count; } }}