Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JavaScript to export pdf to MicroSoft Word

Explorer ,
Nov 11, 2023 Nov 11, 2023

I'm using Acrobat DC.  Looking for javascript code that I can use in a button to export a pdf doc to Microsoft Word format.  I could use the Tools > Export PDF method, but am looking to automate the process with a button.  Thanks.

TOPICS
Modern Acrobat
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 12, 2023 Nov 12, 2023

The basic code to do it is this:

 

this.saveAs({cPath: this.path.replace(".pdf", ".docx"), cConvID: "com.adobe.acrobat.docx"});

 

However, this code needs to run from a privileged context, which usually means from the Console, an Action or a folder-level trusted function. You can't just add it to a button and have it work when the button is clicked.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2023 Nov 20, 2023

Thank you.  I decided to just use the Tools > Export PDF method as I wasn't sure how to run from privileged context.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 11, 2024 Jan 11, 2024
LATEST

Hey, thanks for the help, I am trying to run this code via the Javascript Debugger, but when I do I get the error message:
"The specified file could not be written to. It may be in use." however the only application accessing the pdf is Acrobat. Any suggestions?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines