'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsSystem.LinqImportsSystem.Collections.GenericImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.TextMapImportsGrapeCity.Documents.Pdf.AnnotationsImportsGrapeCity.Documents.Common PublicClassStrikeoutParagraphPublicFunctionCreatePDF(ByVal stream AsStream) AsInteger' Load the PDF:Dim doc = NewGcPdfDocument()Using fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf")) doc.Load(fs) ' Strikeout the first paragraph that starts with the words "Several species":Dim para AsITextParagraph = NothingForEach p In doc.PagesDim paras = p.GetTextMap().Paragraphs para = paras.FirstOrDefault(Function(p_) p_.GetText().StartsWith("Several species"))If para IsNotNothingThenExitForEndIfNextIf para IsNothingThenReturn doc.Pages.Count' Should not happen.EndIf ' Text markup strikeout annotation:Dim markup = NewTextMarkupAnnotation() With { .Page = para.Page, .MarkupType = TextMarkupType.StrikeOut, .Color = Color.Red } ' Get the coordinates of all text run fragments in the paragraph,' and add them to the annotation's area:Dim area AsNewList(OfQuadrilateral)ForEach run In para.RunsForEach frag In run' Note: in v6.0.3 a method ITextRunFragment.GetBounds() was added,' so this code can be replaced with a single 'frag.GetBounds()' call.' Find the text run fragment's index in the containing line:Dim index AsInteger = 0Dim line = frag.LineDim frags = line.RunFragmentsFor i = 0To frags.Count - 1If frags(i) Is frag ThenExitFor index += frags(i).CountNext' Add the fragment's bounds (quadrilateral) to the annotation area: area.Add(frag.Line.GetCoords(index, frag.Count))NextNext markup.Area = area ' Done: doc.Save(stream)Return doc.Pages.CountEndUsingEndFunctionEndClass