Skip to main content
daitranthanhoa
Inspiring
March 31, 2017
Question

How can extract all image by Javascipt?

  • March 31, 2017
  • 5 replies
  • 1269 views

I can extract all image by menu of Acrobat:Tools >> Document Processing >> Export All Images.

But i want call this function from my app.

Can call action from javascript or extract all image by Javascipt?

This topic has been closed for replies.

5 replies

Legend
April 3, 2017

Ok, so the code appears to run, but it does not have the expected result.

Have you confirmed that other code is being run correctly if you use this ExecuteThisJavaScript method? A simple test is to run an app.alert in your code. For example

Dim test = "app.alert(""BEFORE""); <my code to try>; app.alert(""AFTER"")" ...

daitranthanhoa
Inspiring
April 3, 2017

try this code:

Dim test = "app.alert(""BEFORE""); this.saveAs(""/c/tmp/myDoc.html"", ""com.adobe.acrobat.html""); app.alert(""AFTER"")"

Dim b b = AForm.Fields.ExecuteThisJavaScript(test)

Result only show message: "BEFORE"

try67
Community Expert
Community Expert
April 3, 2017

Where are you opening the PDF file that you want to convert?

Legend
April 3, 2017

You wrote "But If i call script from other Application, It can't saveAs.:"  What exactly do you mean by "can't"?

daitranthanhoa
Inspiring
April 3, 2017

If i run from Vb.net:

Dim AForm = CreateObject("AFormAut.App")

Dim test = "this.saveAs(""/c/tmp/myDoc.html"", ""com.adobe.acrobat.html"");"

Dim b = AForm.Fields.ExecuteThisJavaScript(test)

not show any message.

But result not output, have not file html, image.

Legend
April 3, 2017

Complete messages please, please copy/paste. The exact details matter. please make sure the messages come from running the external script NOT from your typed in commands (for which undefined is a normal response).

daitranthanhoa
Inspiring
April 3, 2017

i run from JavaScript Debugger:

this.saveAs("/c/tmp/myDoc.html","com.adobe.acrobat.html"); -> Press Ctrl+enter

undefined

If i run from Vb.net:

Dim AForm = CreateObject("AFormAut.App")

Dim test = "this.saveAs(""/c/tmp/myDoc.html"", ""com.adobe.acrobat.html"");"

Dim b = AForm.Fields.ExecuteThisJavaScript(test)

not show message.

try67
Community Expert
Community Expert
April 3, 2017

"undefined" just means the code executed without errors or returning any

values.

On Mon, Apr 3, 2017 at 10:42 AM, daitranthanhoa <forums_noreply@adobe.com>

Bernd Alheit
Community Expert
Community Expert
March 31, 2017

You can try the export as HTML with the method saveAs.

daitranthanhoa
Inspiring
April 1, 2017

Can i save as html by script or COM?

Bernd Alheit
Community Expert
Community Expert
April 1, 2017

Use the JavaScript method saveAs.

try67
Community Expert
Community Expert
March 31, 2017

You can simulate pressing that button using JS, but it would still require user input to complete the project.

JS can't extract the images from a PDF on its own.