Skip to main content
Participant
July 19, 2018
Question

Flatten, save and email Submit Button using java

  • July 19, 2018
  • 1 reply
  • 3161 views

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.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 19, 2018

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?

Participant
July 20, 2018

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.

try67
Community Expert
Community Expert
July 20, 2018

OK, and what's not working with the way you have it now?