简体   繁体   English

使用Acrobat JavaScript编写文本文件

[英]Using Acrobat javascript to write a text file

I am using acrobat XI to write some script. 我正在使用acrobat XI编写一些脚本。 What I would like to do is 1) get the current processed pdf file name and 2) just simply output a text file 我想做的是1)获取当前已处理的pdf文件名,以及2)仅输出一个文本文件

var textValue = "test";
var doc = this.createDataObject({cName: "test.txt", cValue: textValue});
this.exportDataObject({cName: "test.txt", nLaunch:0});

This is working , but I would like to provided a fixed path , I tried saveAs but it seems only for pdf , exportAsText not working as well. 这是可行的,但我想提供一个固定的路径,我尝试了saveAs,但似乎仅适用于pdf,exportAsText不能正常工作。

Are there any way to fix it? 有什么办法可以解决? thanks 谢谢

Official documentation says: 官方文件说:

Example: Save the current document in rich text format: 示例:以RTF格式保存当前文档:

this.saveAs("/c/myDocs/myDoc.rtf", "com.adobe.acrobat.rtf");

I guess you can replace RTF format with TXT ( com.adobe.acrobat.plain-text ): 我想您可以将RTF格式替换为TXT( com.adobe.acrobat.plain-text ):

this.saveAs("test.txt", "com.adobe.acrobat.plain-text"); // try this

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

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