Firing up Acrobat to view a PDF

I need to run Acrobat Reader from within my vb Express project to display a specific PDF file. I tried theAxAcroPDF1.LoadFile(FileLoc) approach but the Acrobat window is unclear and the page doesn't view fully so using the full Adobe Reader is preferred. I've now tried various versions of :

Dim FileLocAsString

FileLoc = FileLocations(2) &"BAeA-ConSys-Help.pdf"

Dim mydocAs Acrobat.CAcroPDDoc

mydoc = CreateObject("Acrobat.CAcroPDDoc")

mydoc.Open(FileLoc)

but I can't get past "Cannot create ActiveX component.". What am I missing?

Thanks,
Nick B

[1271 byte] By [NickBuck] at [2007-12-24]
# 1

What I've found works much better than trying to hook Acrobat via COM (to do COM interop with Acrobat you should add a reference to to Acrobat and then instantiate it) is to use the WebBrowser control.

You can add the WebBrowser control to the form and then call WebBrowser.Navigate() passing the path and file name of the pdf. This will cause the Acrobat plugin to load in the browser and display the PDF.

rkimble at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

You could also fire the default PDF application file by association (the default application will run outside your application):

Process.Start(FileLocations(2) & "BAeA-ConSys-Help.pdf")

Andrej

AndrejTozon at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3

Might should add that's:

System.Diagnostics.Process.Start()

...might have trouble finding the Process object otherwise.

rkimble at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
NickBuck wrote:

I tried the AxAcroPDF1.LoadFile(FileLoc) approach but the Acrobat window is unclear and the page doesn't view fully so using the full Adobe Reader is preferred.

Try using AxAcroPDF1.Src = FileLoc instead...

nbrege at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5
I've had no problems using the "AxAcroPDF1.LoadFile" with Reader or Acrobat.
What do you mean that the window is not clear?
Did you size the window within your form?
What version of Reader are you using?
If you simply want to display and projt a pdf file, your original method (
AxAcroPDF1.LoadFile) should work.
HemeFlasher at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 6

Sorry it's been a few days - my head's been elsewhere. I've revised my approach now to use the Browser and my help system is html - no wait for it to get going, and simpler for me to create and update.

When it worked the PDF document (on A4 from Word) was not clear like it is when accessed direct thro Adobe Reader, seemed 'fuzzy' as though some anti-alias was being applied somewhere, and I could not get the page bottom to fit properly into the form. As I can't get the thing working properly now I'm not really bothered, but it was an issue for a while. As I can't always guarantee that users will have an up-to-date copy of Adobe Reader 7 I think the html approach is just better all round.

Thanks for the comments anyway.

Nick B

NickBuck at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...