Copy link to clipboard
Copied
Hello, i did a quick search but wasnt satisfied with the language i found regarding my question.
I have a fillable form i wish to send with email via a button on the form using javascript.
When i do this now, acrobat attaches a live fillable file, and not a printed pdf.
This is for a class certificate, and must be sent as a printed pdf and not the editable form.
Can someone please help provide the java code to accomplish this? Its more complex than i can work out on my own.
Thanks for the assistance!
var cToAddr = "email@address.here"
var cSubLine = "Your Certificate of Achievement"
var cBody = "Thank you for your recent participation at our Continuing Education Session.\r" + "Your Certificate of Achievement is enclosed.\r \r" + "If you have any questions, please do not hesitate to reach us."
this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});
Copy link to clipboard
Copied
Is the file going to be sent exclusively from Acrobat, or also from Adobe Reader, or other applications?
Copy link to clipboard
Copied
only using acrobat, sent via outlook
Copy link to clipboard
Copied
Before the mailDoc command, add this line:
this.flattenPages();
Copy link to clipboard
Copied
That worked great! however buttons on the document set to visible but not print, transfered.
Is there some way to hide them with this approach?
I guess I can try making them white with no borders and just "know" they are there! they are functional buttons that reset some form fields, and create pdf for file records.
Copy link to clipboard
Copied
You can use this code to set all non-printing fields as hidden before flattening the pages:
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.display==display.noPrint) f.display = display.hidden;
}
Copy link to clipboard
Copied
Thank you, that is almost perfect!
Im finding that the flatten command takes away the repeat functionality of the file.
I am not able to undo this, to continue editing say, the name field, to create the next certificate, and must be careful not to save the file, revert it, then.
I am hoping to have the workflow go something like:
I found that composing the same email, and attaching the pdf was taking way too long, even when copying message body and subject. this concept of "submit via email button" has really saved time in the process. If it could only be replicated as above!
Copy link to clipboard
Copied
Yes, flattening is not reversible. You can simply close the file without saving it afterwards, though, and then re-open it to start over.
The other options are to set the fields as read-only, and then as editable later on (not secure, but easy to do), or to digitally sign the file, then remove the signature later on (secure, but more complicated to perform).
Copy link to clipboard
Copied
This cannot be done from a script on the form itself.
However, if you are using Acrobat Pro, an automation script can be written to flatten the document and send it.
Copy link to clipboard
Copied
Thanks, so i can use script for button on document that will
can you help me with a sample script to try?