These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Signature JS automation incl. page size read

SBuurma
Registered: Feb 11 2008
Posts: 9
Answered

Hello,

I've been re-programming the standard sdkAddSignature.js which comes with the SDK for Acrobat 7. I get to the point where it places a signature and signs the document. So I've proven for myself that the script works.

But now I'd like to add a few varieties to the script...

I'd like to be able to read the page size, which should trigger the corresponding values for the placement of the signature. My idea was that I could do this with the this.getPageBox("Crop") and then referring to it as a var in the scripting.

So the functionality would basically be as follows:

The script reads the open document for page-size, set this as the var. With "if" programming I would get to the appropriate values, which then make a signature field with the corresponding page-size. After which the signature is silently placed in the created signature-field and silently saved.

I hope I'm clear enough with my question and it is actually possible what I want to do.

My Product Information:
Acrobat Standard 7.0.9, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Have you looked at "Automating placement of annotations -
Converting coordinates in Acrobat" by Thom Parker?

Not only will you need the page size but you may have to adjust for the rotated display space. Thom shows the undocumented "Matrix2D" object to rotate the signature page quads as necessary.

George Kaiser

SBuurma
Registered: Feb 11 2008
Posts: 9
Thanks for your reply.

I've read that point and I'm already converting the points to mm. The matrix2D part I have looked into, but at the moment it doesn't look like it's causing a problem.

I've split up the code to only add the signature field by the read page-size and the problem I run into is:

I want to use [b]this.getPageBox("Crop")[/b]-value to fill my variable called [i]Formaat[/i]. Although this doesn't happen, I read from the console that:

Quote:
this.getPageBox is not a function
But when I use the console to test the [b]this.getPageBox("Crop")[/b]-value, I have to run the line first to get [i]undefined[/i] as an answer and then I can call upon it with the variable-name and it replies the wanted [i]0,2384,3370,0[/i].

When I hardcode the variable to the outcome of the [b]this.getPageBox("Crop")[/b] as in "0,2384,3370,0" and put this into the fieldplacing script it works and listens to the hardcoded value. Also when i vary the different outcomes it will pick the appropriate placement coordinates.

To me it looks that when I can get a variable to output the [b]this.getPageBox("Crop")[/b]-value it would work.

Any ideas so far?
SBuurma
Registered: Feb 11 2008
Posts: 9
I've been trying and looking for another solution and found my way to do it with the addWatermarkFromFile which seems to work awesome.

Thanks for all thoughts.