1

I'm trying to get a selected line of a pdf document which i've displayed in Webbrowser control (c# winform)

This is my code

IHTMLDocument2 htmlDocument = webBrowser1.Document.DomDocument as IHTMLDocument2;

            IHTMLSelectionObject currentSelection = htmlDocument.selection;

            if (currentSelection != null)
            {
                IHTMLTxtRange range = currentSelection.createRange() as IHTMLTxtRange;

                if (range != null)
                {
                    MessageBox.Show(range.text);
                }
            }

i get the following output

8

It doesn't seem to work as i'm getting an empty message box. I've got to know online that in order to edit/highlight text, i might have to use an SDK!

I'd really appreciate any kind of help/guidence here!

Aimal Khan
  • 1,009
  • 1
  • 12
  • 25

0 Answers0