如何使用Javascript保存.pdf文档 [英] How to Save a .pdf document using Javascript

查看:109
本文介绍了如何使用Javascript保存.pdf文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下脚本将pdf文档保存到特定位置:

I am trying to use the following script to save my pdf document to a specific location:

this.saveAs("C:/Users/logan/Desktop/test.pdf");

此脚本保存在app.beginPriv/app.endPriv块内的文件夹级.js文件中.

This script is saved in a folder level .js file, inside an app.beginPriv/app.endPriv block.

每次尝试运行脚本时,都会出现以下错误:

Each time I try to run the script I receive the following error:

TypeError:this.saveAs不是函数

TypeError: this.saveAs is not a function

我知道脚本正在被访问,因为如果我更改脚本以显示一个简单的弹出窗口,该脚本将运行良好.我认为这可能是由于引擎正在处理我的脚本(我正在从Bluebeam而不是Acrobat访问代码).

I know the script is being accessed, because if I change the script to display a simple popup the script will run fine. I believe this is likely due to the engine that is processing my script (I am accessing the code from Bluebeam, not Acrobat).

如果这是问题,我需要知道Bluebeam引擎中等效的运算符将执行另存为过程,但是很遗憾,在线没有此类参考,并且不允许该软件的技术支持提供编码建议.

If this is the problem, I need to know what the equivalent operator would be in the Bluebeam engine to perform the save as process, but unfortunately there is no such reference online, and the tech support for the software isn't permitted to offer advise for coding.

所以我的问题是:除了引擎无法识别脚本之外,还有其他可能原因导致脚本无法运行吗?如果引擎有问题,是否有人能找到我所需的脚本行,对此有何建议?

So my question is: Is there another possible reason for my script not working, other than it not being recognized by the engine? If it is an issue with the engine, does anyone have any advise at all for how to seek out the line of script I need?

预先感谢您的帮助!

推荐答案

您应该将该行代码放入一个函数中,然后对其赋予特权.然后调用该函数,而不是普通的saveAs().

You should put that line of code into a function which you then make privileged. Then call that function instead of the plain saveAs().

这在Acrobat中有效;我对Bluebeam的了解不足,无法确定它是否也是如此.您可以联系Bluebeam支持以获得权威性答案.

This would work in Acrobat; I don't know enough about Bluebeam to determine whether it does too; you might contact Bluebeam support for an authorative answer.

这篇关于如何使用Javascript保存.pdf文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆