开发者

open pdf at specific page using vbscript

开发者 https://www.devze.com 2023-01-13 02:37 出处:网络
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

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 w开发者_开发百科ith 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.


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


Try to use AcroExch.AVPageView.Goto() Method

and avoid the path of adobe executable

0

精彩评论

暂无评论...
验证码 换一张
取 消