简体   繁体   English

用于Adobe Acrobat中的多文件转换的Java失败

[英]Javascript for multiple file conversion in Adobe Acrobat failing

I am trying to convert multiple files from PDF to plain text in Adobe. 我正在尝试将多个文件从PDF转换为Adobe中的纯文本。 I found a solution online that reads: 我在网上找到了一个解决方案,内容为:

/* PDF to Text */



this.saveAs("C:\Users\sandr\Dropbox\Light\Doctorate\Supervisor meetings\2018\October\Method\test_corpus\2sleep.tar\2sleep\2sleep\pdf\txt_output" + this.documentFileName + ".txt","com.adobe.acrobat.plain-text");

The script runs but it always gives an error saying it could not open the file and it doesn't actually create the text file. 该脚本可以运行,但始终会给出错误消息,提示它无法打开文件,并且实际上并未创建文本文件。 Does anyone know why this is? 有人知道为什么是这样吗?

Because Acrobat Javascript needs to run on both Mac and Windows, you need to use platform independent paths. 由于Acrobat Javascript需要同时在Mac和Windows上运行,因此您需要使用平台无关的路径。 Windows-specific file names and paths won't work. Windows专用的文件名和路径将不起作用。 For example... 例如...

this.saveAs("C/Users/user/Dropbox/foo.pdf");

Also... 也...

this.documentFileName

will have a ".pdf" extension at the end, you may want to trim that before appending the ".txt" 末尾将带有“ .pdf”扩展名,您可能需要在附加“ .txt”之前对其进行修整

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

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