使用vbscript在特定页面上打开pdf [英] open pdf at specific page using vbscript
问题描述
我有一个应用程序,可以管理硬盘驱动器上的多个杂志PDF.我需要将PDF文件打开到特定页面.我能够通过自己的软件调用vbscript,因此我正在寻找一些vbscript代码段来打开已加载特定页面的PDF.我是从事跨平台软件开发的Mac开发人员,Windows并不是我的标准.
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.
在Adobe文档中,我检查了是否使用系统调用打开了如下网址:
From the Adobe docs, I checked that using system calls to open a URL like:
http://myserver/mypdf#page = 3
工作正常,但尝试将类似的URL用于伪文件协议,例如:
works fine but trying to use similar URL with the dummy file protocol like:
file://path/to/mypdf#page = 2
file://path/to/mypdf#page=2
不起作用.在弄清楚这一点之后,我决定我应该尝试对某些COM或ActiveX或它们在Windows上最近使用的任何内容进行vbscript调用,但我不知道该怎么做.
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.
感谢您的帮助.
推荐答案
您可以使用Acrobat Reader的"page = ..."参数,如下所示:
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
这篇关于使用vbscript在特定页面上打开pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!