Reputation: 5478
I'm looking for a component which allows to highlight specific words inside PDF document. It will be used for searching.
Some components highlight when you perform a search, but they highlight only the text currently being searched. I need more advanced functionality for showing multiple search words.
Eventually, it will look like searching for multiple words simultaneously.
Possible solution would be conversion to plain text and highlighting in RichTextBox, but I need to retain actual document formatting.
Any suggestions?
Thanks!
Upvotes: 1
Views: 610
Reputation: 9117
webSupergoo has a component called ABCpdf.NET that will let you read and modify PDF files, and the professional version will also render/view them directly in your application. It may be possible to use that to add highlighting to the words you're searching for and then display the result.
Note: I've used this component to generate PDFs, but never to modify them or display them, so I can't speak directly to how well this would work.
Upvotes: 1
Reputation: 15868
I don't know of any out-of-the-box solutions for something like that.
The only thing I'm aware of that might work for this is embedded reader/acrobat with a custom plugin that would handle the multiple searches & highlighting.
IIRC, publishing acrobat plugins is easy, but to "reader enable" plugins requires that Adobe sign them for you, which involves some $$$.
Decidedly non-trivial.
"Retaining the actual formatting" isn't really possible. There is no formatting within PDF to retain. There's coordinates, glyphs, lines, and images (and stuff). No such thing as a word, or a paragraph, alignment, etc. It's all 'draw this shape there'. Most glyphs map to characters, but not all. Some lines look like glyphs, but are straight line art.
It's possible to recreate the formatting information from coordinates and characters, but it's hard, and there's lots of things that can go wrong.
The PDF tag really needs a FAQ that would cover things like this.
Upvotes: 2