简体   繁体   中英

Javascript for multiple file conversion in Adobe Acrobat failing

I am trying to convert multiple files from PDF to plain text in 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. Windows-specific file names and paths won't work. 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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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