Dervin Thunk
Dervin Thunk

Reputation: 20119

Searching and coloring text in a pdf file using c#

I'm afraid I don't even know where to start with the following problem, so if any of you would give me some pointers, I'd appreciate it.

I need to load and display a pdf file. Then I need to search and colorize a few words of interest in said pdf file (noting position, page, etc) using C#. I have Adobe Acrobat 7 professional, so I have some of the COM tools.

Regards.

Upvotes: 0

Views: 1151

Answers (3)

plinth
plinth

Reputation: 49189

My company sells .NET PDF components that can be used to extract text from documents as well as display pages. We have a demo here which does full text search and highlighting of a PDF document, which is very close to what you want to do. As long as the changes don't need to be permanent, this technique will work for you.

Upvotes: 0

JCasso
JCasso

Reputation: 5523

Manipulating a PDF file is hard since pdf is a hard format. There are good libraries does great job such as ITextSharp.

But my advise is convert the pdf file to html and play with the html output. Then display it on a WebBrowser control.

I know this is an ugly solution. Also this ugly solution has another ugly solution for converting a pdf file to html.

See: http://aspdotnetcodebook.blogspot.com/2008/08/how-to-convert-pdf-file-to-text-in.html

Upvotes: 1

Dan Byström
Dan Byström

Reputation: 9244

You can use iText to load, modify and re-save the document. If you can get on by just launching Acrobat afterwards, you're home.

Upvotes: 1

Related Questions