Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
You can try the export as HTML with the method saveAs.
Copy link to clipboard
Copied
Can i save as html by script or COM?
Copy link to clipboard
Copied
Use the JavaScript method saveAs.
Copy link to clipboard
Copied
If i call this script: this.saveAs("/c/tmp/myDoc.html", "com.adobe.acrobat.html"); from Acrobat, It saved ok.
But If i call script from other Application, It can't saveAs.:
Dim AForm = CreateObject("AFormAut.App")
Dim test = "this.saveAs(""/c/tmp/myDoc.html"", ""com.adobe.acrobat.html"");"
Dim b = AForm.Fields.ExecuteThisJavaScript(test)
Copy link to clipboard
Copied
Console messages?
Copy link to clipboard
Copied
message is: undefined, but i check result output ok.
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
"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>
Copy link to clipboard
Copied
You wrote "But If i call script from other Application, It can't saveAs.:" What exactly do you mean by "can't"?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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"")" ...
Copy link to clipboard
Copied
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"
Copy link to clipboard
Copied
Where are you opening the PDF file that you want to convert?
Copy link to clipboard
Copied
Dim oDoc As Acrobat.CAcroPDDoc = CreateObject("AcroExch.PDDoc")
oDoc.Open("D:\1.ATTS_Next\DataTest\test1.pdf")
I try this script, it working ok:
Dim ex = " // set annot for text selection " & vbLf _
& "var sqannot = this.addAnnot({type: ""Square"", page: " & iPage & ", " & vbLf _
& "rect: [" & rect.left & ", " & rect.top & ", " & rect.right & ", " & rect.bottom & "], " & vbLf _
& "name: ""p" & iPage & "i" & i & """});"
Copy link to clipboard
Copied
You can use a try-catch-construct:
try {
... your code ...
} catch(e) {
for (var i in e) console.println( i + ': ' + e);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now