How can export a page to image?

Enthusiast ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

I have a PDF file as below image:

I want export 2 Pages to 2 Images:

With Acrobat Script or COM : Can export a Page to a image ? and Can it remove white area?

Thank you.

pdf.png

TOPICS
Acrobat SDK and JavaScript

Views

1.5K

Likes

Translate

Translate

Report

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

Adobe Community Professional , Apr 23, 2019 Apr 23, 2019
You can use the JavaScript method saveAs to save all the pages of the file as images. If you want to only save two pages you can first extract them from the main file, and then save them. You would need to specify the cConvID parameter as "com.adobe.acrobat.jpeg" to force it to be saved as an image.You might be able to remove the white space using the Preflight tool, before saving the pages as images.

Likes

Translate

Translate
Adobe Community Professional ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

You can use the JavaScript method saveAs to save all the pages of the file as images. If you want to only save two pages you can first extract them from the main file, and then save them. You would need to specify the cConvID parameter as "com.adobe.acrobat.jpeg" to force it to be saved as an image.

You might be able to remove the white space using the Preflight tool, before saving the pages as images.

Likes

Translate

Translate

Report

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
Enthusiast ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

Can  saveAs call from vb.net?

my code can't save image:

       Dim formApp As Object

        formApp = CreateObject("AFormAut.App")

        ' access fields object inside AcroForm.

        Dim fields As Object

        fields = formApp.fields

        Dim strScript As String

        strScript = "this.saveAs(""myDoc.jpeg"", ""com.adobe.acrobat.jpeg"");"

        fields.ExecuteThisJavascript(strScript)

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

What happens when you execute following code in the console of Adobe Acrobat?

this.saveAs("myDoc.jpeg", "com.adobe.acrobat.jpeg");

Likes

Translate

Translate

Report

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
LEGEND ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

I'd expect you to need a full DIPath like /C/Folder/Subfolder/myDoc.jpeg

Likes

Translate

Translate

Report

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
Enthusiast ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

It is ok. it can save to image.

But i call it from vb.net it can't working.

I try with this code:

Dim jso = oDoc.GetJSObject

Try

            jso.saveAs("myDoc.jpeg", "com.adobe.acrobat.jpeg")

Catch ex As Exception

End Try

It occur error:

NotAllowedError: Security settings do not allow access to this property or method.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Look at the documentation of the method saveAs.

Likes

Translate

Translate

Report

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
Enthusiast ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

i try create file [config.js;

myTrustedSaveAs = app.trustedFunction( function ( doc, oArgs )

{

app.beginPriv();

var myTrustedRetn = doc.saveAs( oArgs );

app.endPriv();

return myTrustedRetn;

});

Copy file [config.js] to folder

And run script from console:

myTrustedSaveAs(this, { cPath:"myDoc.jpeg", cConvID:"com.adobe.acrobat.jpeg" });

It show error:

ReferenceError: myTrustedSaveAs is not defined

1:Console:Exec

undefined

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

Did you restart Adobe Acrobat?

Likes

Translate

Translate

Report

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
Enthusiast ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

yes, i had close and open again.

Likes

Translate

Translate

Report

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
Enthusiast ,
Apr 24, 2019 Apr 24, 2019

Copy link to clipboard

Copied

LATEST

sorry, close again, it had working. thank you.

Likes

Translate

Translate

Report

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