VB 2010 Express Webrowser Scrollto

90 views Asked by At

I load a pdf document into a Webrowser:

WebBrowser1.Navigate("F:/Documents/headache.pdf")

Using a button I want to scroll to a position someway down the browser:

Me.WebBrowser1.Document.Window.ScrollTo(0, 50)

On running the code I get the error "NullReferenceException was unhandled". I have searched high and low for a solution but everything I find says my code should work (ie worked for others). Hope some one can help me.


So. After a little more research and head scratching, the WebBrowser1.Navigate will not set the WebBrowser1.Document to a PDF. (Of course the code works no problem with HTML.)

MY SOULTION: I replaced the Webrowser with an AxAcroPDF1 Control and used

Me.AxAcroPDF1.setViewScroll("FitH", 50)

to scroll through the document.

0

There are 0 answers