Naveen Kumar Yadav
Naveen Kumar Yadav

Reputation: 432

How to display a pdf file in browser by passing a search string and need to display that page 1st with contains highlighted search string using java

I already done with displaying a pdf file in browser and i am passing a search string, but it parsing the string into words and then searching in the pdf file .I want whole string search in pdf file directly when i pass the search string

In java ,i done a project tool for pdf search engine where i used the lucene 3.x and pdfbox0.7 works similar google search engine ...

1) Enter the search string in the text box

2) When click on search it will search in the pdf files and display the matched result as a fragment of some text from file ,displays in the result with highlighted words in the result

3) Now when user clicks on the results found it should open the pdf file and the search string must be highlighted in the pdf file...

< object data=".<%=filename%>#search=<%=key1%>&view=FitBH,top&toolbar=0" type="application/pdf" width="1350" height="650"> alt : < a href=".<%=filename%>">test.pdf< /a> < /object>

it is displaying the pdf file in browser with highlighted words of a search string but i need the whole string need to be highlighted...

PLease help me

Upvotes: 3

Views: 1393

Answers (1)

Michael Kohler
Michael Kohler

Reputation: 753

About the part of displaying a pdf directly in the browser: How do you do it? Not everybody has a pdf-plugin in his browser, so the browser would offer to download the pdf as a file. When this happens you can't highlight text in the pdf. Or do you use a library for that?

For displaying PDFs in the browser, you might have a look at pdf.js. Maybe it even supports highlighting a given search string (i.e. triggering the search inside pdf.js).

Upvotes: 1

Related Questions