C# – Get selected text from PDF in web browser control in windows form

citextsharppdfwebbrowser-controlwinforms

I need to know if I can get the selected text from a pdf that has been loaded into a web browser control that is in a windows form. I am using C# and Visual Studio 2008 with .net 3.5 and down. I have the pdf showing in the control but I can not figure out how to get access to the selected text within that document. The mshtml document is null.

Thanks in advance!

Best Answer

To display a PDF you need to render it as an image or a different graphical language like EPS, EMF/WMF etc. So unless some work has been done to overlay the text from the PDF on top of the image, you won't be able to physically select the text.

Have you been able to select text from the PDF when it is shown in the web browser control? If you haven't, then you might need to consider trying to access the text directly from the PDF through a library of some sort.