![highlight pdf highlight pdf](https://i.stack.imgur.com/O0DLM.png)
Result = documentProcessor.FindText(word, searchParameters)ĭocumentProcessor.SaveDocument(".\.\Result. 'HighlightResult(documentProcessor, result) ' Use this method call to add annotations: click on draw rectangle tool, click on change color tool, choose the color and set opacity to about 40, click on change line thickness tool and set to 0 pt, draw a rectangle around the text you want to highlight.if you are not satisfied with the color and opacity then right click the rectangle, click properties and change its appearance. Using graphics As PdfGraphics = documentProcessor.CreateGraphics() ' Get the search results from the FindText method call with search text and search parametersĭim result As PdfTextSearchResults = documentProcessor.FindText(word, searchParameters)ĭo While result.Status = PdfTextSearchStatus.Found ' Comment the following using statement if you use annotations Using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) ĭocumentProcessor.LoadDocument(".\.\Document.pdf")ĭim searchParameters As New PdfTextSearchParameters() (If you wish to highlight the results, you can also use the HighlightResult method - as described above.) The code example below shows how to use the PdfDocumentProcessor.FindText method to search text. Processor.AddTextMarkupAnnotation(result.PageNumber, result.Rectangles(i), PdfTextMarkupAnnotationType.Highlight)Īnnotation.Color = New PdfRGBColor(0.2, 0.6, 0) Public Shared Sub HighlightResult(ByVal processor As PdfDocumentProcessor, ByVal result As PdfTextSearchResults)ĭim annotation As PdfTextMarkupAnnotationData = Processor.AddTextMarkupAnnotation(result.PageNumber, result.Rectangles, PdfTextMarkupAnnotationType.Highlight) Īnnotation.Color = new PdfRGBColor(0.2, 0.6, 0) Public static void HighlightResult(PdfDocumentProcessor processor, PdfTextSearchResults result) The PdfAnnotationData.Color property specifies the annotation color. Use the PdfTextSearchResults.Rectangles property to access the document areas that contain search text. Graphics.AddToPageForeground(result.Page, 72, 72)Ĭall the PdfDocumentProcessor.AddTextMarkupAnnotation method to add an annotation to the search results.
![highlight pdf highlight pdf](https://veryutils.com/image/cache/mpseller/customer-4/shareshot_2019-03-16_11-57-35-500x500.png)
Public Shared Sub HighlightResult(ByVal graphics As PdfGraphics, ByVal result As PdfTextSearchResults, ByVal brush As SolidBrush)įor i As Integer = 0 To - 1ĭim rect As New RectangleF(New PointF(CSng(result.Rectangles(i).Left), CSng() - CSng(result.Rectangles(i).Top)), New SizeF(CSng(result.Rectangles(i).Width), CSng(result.Rectangles(i).Height))) Graphics.AddToPageForeground(result.Page, 72, 72) RectangleF rect = new RectangleF(new PointF((float), (float) - (float)), Public static void HighlightResult(PdfGraphics graphics, PdfTextSearchResults result, SolidBrush brush)įor (int i = 0 i < i++)