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

Suppress Save AS after Signature.

HereMyGo
Registered: Apr 7 2009
Posts: 7

Dist,

I am a PLM admin for my company and we have been looking at taking the PDF's created from the CAD models (different packages) and signing them using Acrobat Professional 8.x.

I am however encountering an issue when I open the file from my PLM system and sign the file, it asks me to "Save As". I select to save it as the file that it has temporarily extracted to my local file system. However this fails complaining that the document is open in multiple places (I suppose something to do with opening it from the PLM system).

I can get around this by first extracting the file, locating it, opening it, signing it, closing it, checking it back in manually. This works fine.

I'd like to know however if there is a way to change the "Save As" functionality to be just "Save". My reasoning for this is because during testing, I was able to use mockup tools on the pdf, and click "Save" and the changes took. However if I use Save As I get the same error as if I was signing the document.

I noticed that Adobe Pro 7 use to have a Sign and Save option. But if I can avoid it, I would rather not go back to an earlier version.

So is there a way to change this functionality?

Any/all insight is greatly appreciated.

Best Regards,
Sean.

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can use JavaScript to silently Sign and Save a PDF back to the original file or to a new file. This avoids displaying the SaveAs dialog. But if you are saving back to the original you might still get the multiple places error, but it's worth a try

Here's the basic sequence, you'll need to fill in the parameters with your own values
// Get and login to security handlervar oSigHdlr = security.getHandler( "Adobe.PPKLite" );oSigHdlr.login( cPwd,cPathtoSigFile); // Setup Signing Propertiesfld = this.getField("SignatureFld");fld.signatureSetSeedValue({legalAttestations:["What, me worry?"],reasons:["For the heck of it"]}); // Apply Signature and save back to original filevar bRtn = fld.signatureSign({oSig:oSigHdlr, bUI:false, oInfo:{password:cPwd}});

For a simple test run the code from the Acrobat Console Window. If it works you can place it in a folder level script that creates a toolbar button that runs this code from a trustedFunction.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

HereMyGo
Registered: Apr 7 2009
Posts: 7
thomp,

This is very interesting, and definitely something I didn't even realize could be done. When I say that I am referencing the ability to tap into the API.

Though I am new to .js I am not knew to .java...so having said that, I will have to look into the API to see exactly what some of your code does. However just looking at it, I think there are some details that I may have omitted in my original question/post.

1) I see from your code, the oSigHdlr takes in a parameter for a path to the file to be signed. My problem that I see here is that this path is dynamic. Dynamic in the sense that it opens the base to the temp dir is always the same however it generally creates a new folder within that temp dir where it places the .pdf. So somehow (and perhaps there is a function to get this) I'll need to get the path from the file that is currently opened.

2) The original PDF when opened will not have a predefined signature field. Rather on the drawing itself there will be block in the drawing border where users will need to place their signature by defining the signature field (by clicking sign and marking off the area inside of Adobe). Obviously I would like to have predefined fields, however at this point I do not think it's possible for the CAD packages which generate these .pdf files to specify signature fields. Will this be a limitation as per the second section of your code?

I hope the two statements above aren't too convoluted and you can follow my train of thought with them.

Eitherway, I will start doing some reading into the API.

I really, REALLY, appreciate your post above it is definitely a step in the right direction.

Sean.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Sean,
Signatures, and PDF security in general, tend to be very confusing topics. So don't sweat it. Everybody is confused all the time.

First, the path I refer to, "cPathtoSigFile", is the path to the digital signature file, not a PDF file. This is all in the Acrobat JavaScript Reference.

Second, it's certainly possible to dynamically create a signature field and place it at a predefined location on a page. I'm pretty sure that this can all be done in Reader, as long as the form is enabled with the proper Reader Rights, which I think are covered by the Rights Enabling that you can do from Acrobat Pro.

You can create an Acrobat toolbar button that when clicked will silently add a signature field to the pdf and apply a signature to it.

But, there is one very important point that you have to understand about all of these operations. The user's system has to be setup to do it. The user must install a folder level script onto thier system and have a digital signature file on that system that is known by the folder level script. This is not the sort of thing that can be done from a button on a PDF. It all has to be on the users system.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

HereMyGo
Registered: Apr 7 2009
Posts: 7
Thom,

First off, really appreciate the very detailed post again!!

So I've created the javascript, and have edited the variables (cPwd and CPathtoSigFile) respectively. However, when I open a pdf and go into the console, I receive an error:

this.getField is not a function
8:Folder-Level:App:SigScript.js

I have concerns that first off I am not running the debugger properly. In order to run it, I am simply opening Adobe and then going to the advance menu -> Document Processing -> Java Script Debugger. When I get an error, in order to correct it do I need to always close and restart Adobe for the change to take effect?As for the error above, what does "this" represent in this context? I would have thought "this" is the Adobe file that has a signature field already on it, however I am not sure.

Any insight would be appreciated, as always I will continue reading the API.

Thanks again,
Sean.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
"this" is a keyword in Acrobat JavaScript. It's a pointer to the "current" object. In most Acrobat scripting situations its a pointer to the current document object. You've obviously hit one of those rare situations where it's not the current document.

Did you test the code from the console window before placing it into a Folder Level Script? Do this first so you know the code works.

When you put the code in a folder level script, did you wrap it in a trusted function?

Folder level scripts are loaded and run immediatly when Acrobat is first started. The error suggests that the code was run before any documents were open in Acrobat.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

tarekahf
Registered: May 1 2008
Posts: 91
I have similar requirements, but with the following details.

I am using LiveCycle Designer 8.2 and I want to implement this requirement on the Client PC Level.

Using JavaScript, I need to retrieve (access) the default User Certificate installed on the User PC (default Digital ID used to sign PDF Documents), and identify the User Identity based on a predefined Serial Number which is retrieved from the Digital ID.

Using the retrieved User Identity, I need to show/hide some controls on the LiveCycle Form and prevent/allow the user to perform certain actions.

I do not want to use Folder-Level Scripts, since such feature require some additional work to be done on the User PC which is not an option for such case.

Example:

I have a form which need to be filled by any Staff in Section 1.

Then, the form must be completed and verified by certain users from HRMD, and the authorized HRMD Staff must edit Section 2. Only certain HRMD should be allowed to edit Section 2 of the form.

How I can implement such requirement ?

Tarek.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Acrobat JavaScript is severly limited in the types of user data that it can access. Obviously, for very good security reasons. What you want to do requires a high level of privilege, i.e., the user must give explicit permission for a script to access the digital signature info. There are two ways for the user to provide this permission.

1) install a folder level script
2) the document containing the script must be certified and valid with a digital signature on the users system.

In your case #2 would work, except there is a complication. Certification can be easily invalidated. You've got a complex process. To keep users from filling out a section of the form you'd probably want to hide or gray out a section of the form until it's signed. I'm not sure the certification would survive the process. You'd have to do a lot of testing for each step of the process to make sure it works the way you want.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

MythixPDF
Registered: Jul 26 2010
Posts: 5
Thom,

I think this thread is the closest to my own issue as i've found so far. My situation is this:

The form i am working with, once ready to be signed... needs to save to a specific location WHEN it is signed. Currently when signed with a digital signature it opens to the last default/used location. I do not want to change anything other than where it saves. Is there a way either with a folder level .js file or in PDF javascript that i can designate the specific location within the digital signature?

The need of the form functionality is that the user will open it from a remote server, fill out the form, sign it (save as to a different location on that server), then silently print it to 2 different printers via a folder level javascript and then the document closes. The save menu feature has been disabled also so the user cannot manually save it from the menu.

If at all possible it needs to save only once as the filled out form should only be in one location for legal reasons. Is this possible? and how would i go about accomplishing this?

Any help and/or advice would be greatly appreciated.

Thanks,
Nate
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes this is possible with a folder level script. However, scripting a signature is an advanced topic. There are a huge variety of options for the JavaScript functions that do the signing and it will take a little experimentation to get the code right for your specific setup. Take a look at the "field.signatureSign()" function in the Acrobat JavaScript Reference. There are some very helpful examples there.

There is one major hitch though. Opening from a remote server is not a problem, but Acrobat cannot save directly to a Web folder unless it's a WebDav. Do you mean that it will be opened and saved to a shared network drive?


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

MythixPDF
Registered: Jul 26 2010
Posts: 5
Awesome! I will research that function now and see what I can come up with.

I am in the process of figuring out how to have the client store/open the original so that there is no chance of overwriting the original. Possibly web based interface so that they can access it from anywhere on their network. Then once they are done this save function will point them directly to the desired section of the network drive.

I appreciate the quick reply! Now to meet my deadline...

Thanks,
Nate