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 FileLocAsStringFileLoc = FileLocations(2) &
"BAeA-ConSys-Help.pdf"Dim mydocAs Acrobat.CAcroPDDocmydoc = 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]
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.
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
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