简体   繁体   English

在Apple上使用Acrobat Javascript打开pdf

[英]Opening pdf using Acrobat Javascript on Apple

I would like to open a pdf document using Javascript in Acrobat Pro DC running OSX. 我想在运行OSX的Acrobat Pro DC中使用Javascript打开pdf文档。 Here's what I see: 这是我看到的:

app.openDoc("~/Desktop/test.pdf")
Invalid Location "~/Desktop/test.pdf". File or folder does not exist.
NotAllowedError: Security settings prevent access to this property or method.
App.openDoc:1:Console undefined:Exec
undefined

I wonder whether the error is the security restrictions mentioned on page 135 of the Javascript for Acrobat reference . 我想知道错误是否是Java脚本第135页提到的安全限制,供Acrobat参考

Because Acrobat JavaScript is cross-platform, you need to use device independent paths and you can't use device-specific shortcuts like "~". 由于Acrobat JavaScript是跨平台的,因此您需要使用设备无关的路径,并且不能使用设备特定的快捷方式,例如“〜”。 Something like the examples below. 类似于以下示例。

Windows Path C:\\MyFolder\\MyFile.pdf Windows路径C:\\ MyFolder \\ MyFile.pdf

app.openDoc("/C/MyFolder/MyFile.pdf");

Macintosh path MyDisk:MyFolder:MyFile.pdf Macintosh路径MyDisk:MyFolder:MyFile.pdf

app.openDoc("/MyDisk/MyFolder/MyFile.pdf");

You can use "../" for relative paths. 您可以使用“ ../”作为相对路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM