//// 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; namespaceDsPdfWeb.Demos{// This example shows how to create a caret annotation used to indicate a specific position in a text.publicclassAddCaretAnnotation {publicintCreatePDF(Stream stream) {usingvar fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf"));var doc = newGcPdfDocument(); doc.Load(fs); foreach (var page in doc.Pages) {var tm = page.GetTextMap();// insert the CaretAnnotation after "The Importance" text tm.FindText(newFindTextParams("wetlands", false, false), (fp_) => {// Add a CaretAnnotation near the found text:var r = fp_.Bounds[0].ToRect();var ca = newCaretAnnotation {Page = page,Rect = newRectangleF(r.Left - 8, r.Bottom - 16, 16, 16) }; }); }// Done: doc.Save(stream);return doc.Pages.Count; } }}