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

How to apply the js API in external js?

New Here ,
Jan 19, 2016 Jan 19, 2016

In Acrobat DC's javascript debugger, I can convert pdf file to xml using codes like below.

var myDoc = app.openDoc("/C/Users/EAGLE/Desktop/test.pdf");

myDoc.saveAs("/C/Users/EAGLE/Desktop/test.xml", "com.adobe.acrobat.xml-1-00")

I want to implement this function in external js script for batch of my PDF files. Please tell me how to do this. THX~~~

TOPICS
Acrobat SDK and JavaScript , Windows
1.3K
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

correct answers 1 Correct answer

Community Expert , Jan 19, 2016 Jan 19, 2016

No, Acrobat is not suited for that kind of automation.

If you want you can place the code outside a function, though. That way it will immediately execute each time you open the application...

Translate
Community Expert ,
Jan 19, 2016 Jan 19, 2016

Do you mean as a part of an Action in Acrobat Pro?

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
New Here ,
Jan 19, 2016 Jan 19, 2016

If I create a js file on my computer/desktop, how can I invoke the acrobat api in it? like the app.openDoc() and saveAs()?

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 ,
Jan 19, 2016 Jan 19, 2016

You need to place the code inside a function and then call it. Like this:

In the folder-level script:

function myExportAsXML() {

    // Put your code here...

}

In your Action, or from a menu item, or the console, etc.:

myExportAsXML();

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
New Here ,
Jan 19, 2016 Jan 19, 2016

You mean call it in Acrobat DC? Can I do the conversion without opening Acrobat DC, without its console and action?

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 ,
Jan 19, 2016 Jan 19, 2016

No, Acrobat is not suited for that kind of automation.

If you want you can place the code outside a function, though. That way it will immediately execute each time you open the application...

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
New Here ,
Jan 19, 2016 Jan 19, 2016

Thanks very much~!

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
Engaged ,
Jan 20, 2016 Jan 20, 2016
LATEST

Mmh,

have a look into the AcroSdk and esp. at the JS-Object.

Hth, Reinhard

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