Hi there, Can i save as pdf form to jpeg by a script on button

Jul 24, 2019

Copy link to clipboard

Copied

Hi there my question is to save a pdf form to JPEG image by a button on the form ? with script of any other option.

regard

sam

TOPICS
Acrobat SDK and JavaScript

Views

279

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

Hi there, Can i save as pdf form to jpeg by a script on button

Jul 24, 2019

Copy link to clipboard

Copied

Hi there my question is to save a pdf form to JPEG image by a button on the form ? with script of any other option.

regard

sam

TOPICS
Acrobat SDK and JavaScript

Views

280

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
Jul 24, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

Look at the method saveAs of the doc object.

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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

HI,

According to the documentation you can only saveAs to jpeg from a batch or console event.

You might want to explore privileged context as that may give you some more options.

documentation is here - https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp

Regards

Malcolm

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

Thanks Barlae DC,

as i am new to Batch and console event, i will must to explore them , but i researched over the web that it could be possible by creating trusted functions, Could you help me on that , that how and where we could create folder level functions.

regards

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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

I am unable to locate the user folder , as the below command give me error in the acrobat console,

app.getPath("user", "javascript");

GeneralError: Operation failed.

App.getPath:1:Console undefined:Exec

2

undefined

how can i manually create the user folder ?

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
Reply
Loading...
Jul 25, 2019 0
Most Valuable Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

What version of Acrobat do you have, and on what OS?

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

it is Acrobat X pro and OS is windows 10

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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

The path is at:

C:\Users\<user>\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

Thanks  Bernd, i found it ,

as per the documentation above , i am trying to create a button on pdf form which will save the pdf file in the image file .

the code at the button is :

// build file name

var myFileName = this.getField("Dropdown31").value + " - " + this.getField("Text1").value + "_C" + ".jpg";

// add folder name

myFileName = "/c/Documents and Settings/pac-man/Desktop/Invoices/" + myFileName

myTrustedSpecialTaskFunc(this, myFileName,"com.adobe.acrobat.jpeg");

and at the user folder i have created a config file with the below code:

mySaveAs = app.trustPropagatorFunction(function(doc,path) {

app.beginPriv();

doc.saveAs({ cPath: path, cConvID: "com.adobe.acrobat.jpeg");

app.endPriv();

})

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {

app.beginPriv();

mySaveAs(doc,path);

app.endPriv();

});

now reloaded the acrobat , but no success

any idea where i am doing wrong.

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
Reply
Loading...
Jul 25, 2019 0
Most Valuable Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

What does "no success" means, exactly? Are you getting an error message of some kind in the JS Console?

Also, be aware that Acrobat X is not officially compatible with Windows 10.

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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

Any error message in the console (ctrl+j) ?

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

when i run the functions int he console it said:

mySaveAs = app.trustPropagatorFunction(function(doc,path) {

app.beginPriv();

doc.saveAs({ cPath: path, cConvID: "com.adobe.acrobat.jpeg");

app.endPriv();

})

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) {

app.beginPriv();

mySaveAs(doc,path);

app.endPriv();

});

SyntaxError: missing } after property list

5: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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

You must use:

doc.saveAs({ cPath: path, cConvID: "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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

now no error in console, but a blank screen...

is there any issue with the button script also , because it does not run any function .

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
Reply
Loading...
Jul 25, 2019 0
Jul 25, 2019

Copy link to clipboard

Copied

when i run the button code in console , it gives the below error

// build file name

var myFileName = this.getField("Dropdown31").value + " - " + this.getField("Text1").value + "_C" + ".jpg";

// add folder name

myFileName = "/c/Documents and Settings/pac-man/Desktop/Invoices/" + myFileName

myTrustedSpecialTaskFunc(this, myFileName,"com.adobe.acrobat.jpeg");

TypeError: this.getField("Dropdown31") is null

2: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
Reply
Loading...
Jul 25, 2019 0
Adobe Community Professional ,
Jul 25, 2019

Copy link to clipboard

Copied

That means that you don’t have a field with that name. Maybe a typo?

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
Reply
Loading...
Jul 25, 2019 0
Most Valuable Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

Also, you should change this:

myTrustedSpecialTaskFunc(this, myFileName,"com.adobe.acrobat.jpeg");

To just:

myTrustedSpecialTaskFunc(this, myFileName);

The third parameter is not used in your code, as you hard-coded the conversion string into the folder-level function.

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
Reply
Loading...
Jul 25, 2019 0
Most Valuable Participant ,
Jul 25, 2019

Copy link to clipboard

Copied

Just checking: will you personally be the only person using the form? Or are you planning to send it out?

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
Reply
Loading...
Jul 25, 2019 0
Jul 26, 2019

Copy link to clipboard

Copied

Thanks alot guys, it worked now , but now it worked only with me, when i sent that form to anyother , it did not work .

it there any solution for this .

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
Reply
Loading...
Jul 26, 2019 0
Adobe Community Professional ,
Jul 26, 2019

Copy link to clipboard

Copied

Does the other people use also 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
Reply
Loading...
Jul 26, 2019 0
Jul 26, 2019

Copy link to clipboard

Copied

yes, they do

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
Reply
Loading...
Jul 26, 2019 0
Adobe Community Professional ,
Jul 26, 2019

Copy link to clipboard

Copied

They must also install the folder level script.

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
Reply
Loading...
Jul 26, 2019 0
Most Valuable Participant ,
Jul 26, 2019

Copy link to clipboard

Copied

1. Folder level scripts must be set up by walking to a computer, to protect people from bad stuff. Changes to your folder level scripts apply to your computer. You must make identical changes, adapted to work with Acrobat Reader as needed, on every other computer.

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
Reply
Loading...
Jul 26, 2019 0
Jul 26, 2019

Copy link to clipboard

Copied

but how can i make changes in 500 computers ,? it is difficult

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
Reply
Loading...
Jul 26, 2019 0
Most Valuable Participant ,
Jul 26, 2019

Copy link to clipboard

Copied

It is supposed to be difficult because otherwise it is a HUGE security hole. But that is how you can do this.

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
Reply
Loading...
Jul 26, 2019 0
Jul 26, 2019

Copy link to clipboard

Copied

Security hole???

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
Reply
Loading...
Jul 26, 2019 0