Skip to main content
Participant
Sep 20, 2021 6:27 PM UTC
Answered

READER javascript to save as other text

Hi all;

 

I am trying to automate saving as a text file from Reader with a folder level javascript. doc.saveAs() does NOT work as there are no PDF converters in Reader (app.fromPDFConverters.length; returns as undefined, this also matches with looking in the save as menu item and seeing only pdf as the only save type option). 

 

For my reader installation I can access the menu item in the below screenshot with the following method app.execMenuItem("ADBE:SaveAsAccText"). I have not been able to find in the SDK a more direct access method.

 

 

The problem is that this opens the save as explorer window and it does not sound like I can automate pressing the save button (also saving to another location).

 

So my ask is: 

1) is there a setup I am missing that would get doc.saveAs() to save as a text file? If yes, can you point me to where?

2) is there an alternative to app.execMenuItem("ADBE:SaveAsAccText") that allows parameters?

3) can parameters (directory path) be passed to the  app.execMenuItem("ADBE:SaveAsAccText") that would allow the save button click and new folder path? If yes, how?

 

Thanks in advance for your help.

 

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Sep 20, 2021 7:36 PM UTC

1) No. It seems Adobe failed to update this list for Reader, either on purpose or not. Without this list being populated you can't save the file under a different format.

2+3) No.

The only alternative I can think of is to collect all the text in the file one word at a time and then export it.

However, Reader can't create new text files, so your only option is to display the text to the user, possibly using a Dialog object, and then have them copy it from there. That's hardly automated, though, and might be easier to just use the built-in command...

3 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Sep 20, 2021 7:36 PM UTC

1) No. It seems Adobe failed to update this list for Reader, either on purpose or not. Without this list being populated you can't save the file under a different format.

2+3) No.

The only alternative I can think of is to collect all the text in the file one word at a time and then export it.

However, Reader can't create new text files, so your only option is to display the text to the user, possibly using a Dialog object, and then have them copy it from there. That's hardly automated, though, and might be easier to just use the built-in command...

Translate
JS newbieAuthor
Participant
Sep 23, 2021 11:40 PM UTC

Thanks for response. If I understood you, I tried getPageNthWord, and that was not successful, in that it drops punctuations. So large/decimal numbers are not properly captured. In the end, I used a vba script that sent keys to reader to perform the save as other command. 

Translate
try67
Community Expert
Community Expert
Sep 24, 2021 9:36 AM UTC

To include punctuation symbols in the output of getPageNthWord you must specify the bStrip parameter (the third one) as false. By default it's true.

Translate