We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Search Highlight Result used in Viewer

Hello GroupDocs,

I am tasked to create a POC using GroupDocs.Viewer and C# to show pdf document search results. At this time I have the viewer working using HtmlViewOptions, and am able to render the html results on my front-end. I can manually use regex to highlight specific words in the html, but it isn’t ideal.

I was able to index.Highlight to highlight one of these pdfs through GroupDocs.Search, but the resulting html loses the formatting and rendering that I get through GroupDocs.Viewer.

So the overarching question is: Can I use the highlighting tool mixed in with GroupDocs.Viewer to get a pdf to render in html like it does with GroupDocs.Viewer, but have the highlighting using GroupDocs.Search without losing the original pdf’s formatting?

If so, where can I find documentation or examples or this process?

Thanks,
John.

@johnnyrentallan

Thank you for your question. Just want to clarify that you want to highlight search results using GroupDocs.Search in PDF file and render it to HTML using GroupDocs.Viewer?

Please also check this example. The example is using GroupDocs.Viewer to render a file to HTML and GroupDocs.Search is used to highlight the output HTML produced by Viewer.

@vladimir.litvinchik

Thanks Vladimir, your clarification is correct.
I will take a look at the example and see what I can extract.

Much appreciation for the swift reply.
John.

1 Like

@johnnyrentallan

You’re welcome. Please let us know if provided solution works for you.