'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystemImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.AnnotationsImportsGrapeCity.Documents.Common '' This example shows how to find all occurrences of a phrase in a PDF document and'' highlight all those occurrences using the text markup squiggly underline annotation.'' To ensure that all occurrences of the phrase ("javascript framework") are found'' even if the words are separated by a line break, regular expressions are turned'' on in the search.PublicClassFindAndSquigglyPublicFunctionCreatePDF(stream AsStream) AsInteger' Load an existing PDF:Dim doc AsNewGcPdfDocument()Using fs = File.OpenRead(Path.Combine("Resources", "PDFs", "CompleteJavaScriptBook.pdf")) doc.Load(fs) ' Find all occurrences of the phrase "javascript framework" using regex so that' words separated by line breaks are found:Dim ft AsNewFindTextParams("javascript\s+framework", False, False, , , , True)Dim found = doc.FindText(ft, Nothing) ' Add a text markup annotation to wavy underline each occurrence:ForEach f In foundDim markup AsNewTextMarkupAnnotation() With { .Page = doc.Pages(f.PageIndex), .MarkupType = TextMarkupType.Squiggly, .Color = Color.Magenta }Dim area As List(OfQuadrilateral) = New List(OfQuadrilateral)ForEach b In f.Bounds area.Add(b)Next markup.Area = areaNext ' Done: doc.Save(stream)Return doc.Pages.CountEndUsingEndFunctionEndClass