1
votes

I have an application that manages multiple magazine PDFs on the hard drive. I need to open the PDF files into a specific page. I am able to call vbscript from my own software so I am looking for some vbscript snippet to open a PDF with a specific page loaded. I am a mac developer doing cross platform software, windows is not my standard bread and butter.

From the Adobe docs, I checked that using system calls to open a URL like:

http://myserver/mypdf#page=3

works fine but trying to use similar URL with the dummy file protocol like:

file://path/to/mypdf#page=2

does not work. After figuring that, I decided that I should try some vbscript call to some COM or ActiveX or whatever they use these days on windows but I don't know how to do it.

Thanks for any help.

2
Are you trying to open the PDF with the system's default PDF reader in a separate process, e.g. Acrobat, or as a frame in your own process (using ActiveX / COM)? If it's a separate process then I expect there's a command-line parameter for the process you can use, but may vary per reader. - Rup
I am trying to open the PDF with the system default PDF reader it is usually acrobat. - Andre Garzia

2 Answers

3
votes

You could use the "page=..." parameter of Acrobat Reader, like this:

Sub OpenPdf(filename, page)
   Set wshShell = WScript.CreateObject("WSCript.shell")
   wshShell.Run """%ProgramFiles%\Adobe\Reader 9.0\Reader\AcroRd32.exe"" /A ""page=" & _
      page & """ " & fileName
End Sub

OpenPdf "c:\temp\myfile.pdf", 20
0
votes

Try to use AcroExch.AVPageView.Goto() Method

and avoid the path of adobe executable