简体   繁体   English

在Adobe Reader中使用Javascript

[英]Using Javascript in Adobe Reader

I am currently using the following script for a few documents: 我目前在一些文件中使用以下脚本:

var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
this.print(pp);

How do I add another command, say document.close() so that it reads the print function and then follows the close document last? 如何添加另一个命令,例如document.close()以便它读取打印功能,然后最后跟随关闭的文档? Do I simply add the close command right after the print command so it would read 我是否只需在print命令之后添加close命令,它就会读取

var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
this.print(pp);
document.close();

Thanks. 谢谢。

ADDITION 加成

My problem here is I cannot figure out how to finish off one command and get right into the next. 我的问题是我无法弄清楚如何完成一个命令并直接进入下一个命令。 I have given up on trying to make the document close, since I realized it will open in the browser. 我已经放弃尝试关闭文档的操作,因为我意识到它将在浏览器中打开。 So now my next idea is to use history.back(-1); 所以现在我的下一个想法是使用history.back(-1); after the print command. 在打印命令之后。 I just don't understand how to start/stop commands in the javascript. 我只是不明白如何在javascript中启动/停止命令。

add this history.go(-1); 添加此history.go(-1); instead of history.back(-1); 而不是history.back(-1);

The print function should block (pause) until the user finishes dealing with the print dialog, then continue. print功能应阻止(暂停),直到用户完成对打印对话框的处理,然后继续。 You don't have to do anything special to run more code after it. 您无需执行任何特殊操作即可在其后运行更多代码。

That said, do you really need to force the document to close after it prints? 就是说,您真的需要在文件打印后强制将其关闭吗? As a user, I'd be pretty miffed if a website did this to me. 作为用户,如果一个网站对我这样做,我会感到非常沮丧。 What if I want to save the PDF to my computer? 如果要将PDF保存到计算机怎么办? What if my printer was low on ink and I need to print it again? 如果我的打印机墨水不足,需要再次打印怎么办? Let me decide when to close your PDF. 让我决定何时关闭PDF。

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

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