Copy link to clipboard
Copied
I want to flatten, save and email a PDF using javascript. The document will be saved on a local server but emailed to someone who will not always have access to. I want the file to be sent as PDF but when it arrives to the recipient they get the error message that the file cannot be found as they do not have access to the server..
What is the best javascript to use here?
I'm using Windows, have Acrobat DC.
Copy link to clipboard
Copied
Flattening requires using Acrobat.
Saving (assuming you want to specify the file-name) requires installing a script on the local machine.
Are those two things possible in your case?
Copy link to clipboard
Copied
I'm not exactly sure - so - lets assume for now it's not possible and forget flattening the file and just focus on save and email.
In the case I described I would need someone without access to local server (working remotely) to be able to view the PDF.
Currently the actions I have added to my SUBMIT button are:
MOUSE UP
- run javascript:
flattenFields()
function flattenFields() {
if (app.viewerType=="Reader") {
for (var i=0 ; i<this.numFields ; i++) {
var f = this.getField(this.getNthFieldName(i)) ;
if (f==null) continue;
f.readonly = true;
}
} else {
this.flattenPages();
}
}
- execute a menu item: File > Save As (user nominates the Folder in Server and saves)
- Run javascript
var url = "mailto:software@cliffordwallace.com.au?subject=New Feature Request&body=I would like to submit a new feature request. Please find attached.";
this.submitForm(url,true);
All I want is for the form to be saved as PDF and emailed to the software email flattening it isn't imperative.
Copy link to clipboard
Copied
OK, and what's not working with the way you have it now?
Copy link to clipboard
Copied
You should do it all using a single script, like this:
function flattenFields() {
...
}
flattenFields();
app.execMenuItem("SaveAs");
var targetURL = "mailto:software@cliffordwallace.com.au?subject=New Feature Request&body=I would like to submit a new feature request. Please find attached.";
this.submitForm(targetURL,true);