Click here to Skip to main content
15,071,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,
I want to search and highlight the text in pdf. In my window application i will show the pdf in webbrowser control.using acrobat, webbrowser control shows the pdf. based on the values in textbox i need to search and highlight the text. i have tried by passing in url. the below mentioned code searched the word.

i had been gone though adobe document and i was came to know that there is a option to highlight the text based on co-ordinates.

For eg.,highlight lt,rt,top,bottom

but if i passed it in url means it can't highlight. if you have any idea on this?

VB
Dim filename As String
Dim value As String
filename = RTBHeadLine.Text
filename = WebBrowser1.Url.ToString()
If filename <> "" Then
    value = HttpUtility.UrlEncode(RTBHeadLine.Text.Normalize)
    value = value.Replace("+", " ")
    WebBrowser1.Refresh()
    Me.Text = filename & "#search=" & """" & value & """"
    WebBrowser1.Refresh()
    WebBrowser1.Navigate(filename & "#search=" & """" & value & """")
    WebBrowser1.Refresh()
End If
Posted
Updated 9-Jul-21 11:17am

1 solution

For example :
- Your search returned (2 results)
- Create a Temp PDF file as clone from the Original PDF File, but with highlighted results.
- Append your Temp PDF File to the WebBrowser Control, using your Acrobat lib.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900