Use the scripts below, in conjunction with Laserfiche Import Agent, to send PDF forms directly into Laserfiche with the click of a button and streamline business processes such as open enrollment.

How to create and configure the button

Since Adobe does not allow you to automatically save the PDF at a specific location through a button, you need to configure this button with a two-part script. For the purposes of this example, we are saving all the files in a folder on our hard drive called C:\pdfsubmission. You will have to modify the scripts to reference your preferred storage location.

Note: In this example we use Adobe Acrobat X. This process should also work with other versions of Adobe Acrobat.

  1. First you need to add a Submit Button to your form. Under Actions, make sure to select Mouse Up as the Trigger.

    Click image to view larger in new window.

    Click image to view larger in new window.

    Double-click on Run a JavaScript to open the JavaScript Editor:

    Here is the script to copy into the editor window:
    //This script has the action (Save) and location where it will be saved.
    // First make sure the function exists
    if(typeof(mySaveAs) == "function")
    {// Now split out the pure "Path" portion of file path
    // for calling the function
    var nLast = this.path.lastIndexOf("/");
    var cPath = "/C/pdfsubmission/";
    mySaveAs(this,cPath, this.documentFileName);
    }
    else{
    app.alert("Missing Save Function\n" +
    "Please contact forms administrator");
    }

  2. Copy the config.js file that you can find in this zip file into the C:\Program Files\Adobe\Reader 10.0\Reader\Javascripts folder on your hard drive. If you have another version of Adobe Acrobat installed, this folder path will be slightly different.
    Note: Every person who will be eventually filling out this form must have a copy of the config.js file stored in the above directory on their hard drive for the button to work correctly.var mySaveAs = app.trustedFunction(
    function(oDoc,cPath,cFlName)
    {
    app.beginPriv();
    // Ensure path has trailing "/"
    cPath = "/C/pdfsubmission/";
    //cPath.replace(/([^\/])$/, "$1/");
    try{
    oDoc.saveAs("/C/pdfsubmission/" + cFlName);
    }catch(e){
    app.alert("Error during save");
    }
    app.endPriv();
    });
  3. In order for this button to work correctly for users who will be filling out this form with Adobe Acrobat Reader (not Adobe Acrobat), you have to save the entire PDF with the Extended Reader Functionality. To do this, navigate to the File menu – Save-AsReader Extended PDFEnable Additional Features.
  4. Once the PDF has been saved with Extended Reader Functionality, you can configure Laserfiche Import Agent to automatically import files into Laserfiche from the network folder into which they were submitted. Laserfiche Import Agent is an optional tool for automatically retrieving files stored in a Windows folder and importing them into a Laserfiche repository.

Incorporate this button into your workflows

Laserfiche Workflow 8.3 brings a large number of new activities, including the following ones related to working with PDFs:

  • Retrieve PDF Form Contents
  • Fill Out PDF Form
  • Verify PDF Signatures

You can incorporate both the new PDF activities and the form with the custom button into your workflow.

Example:

Z-Tech Fabrication Company would like to send out an Open Enrollment form to every employee. Z-Tech creates a form and adds a custom Submit to Laserfiche button using the scripts described above.

In order to simplify this process and reduce errors associated with entering incorrect data, Z-Tech has designed a workflow that pre-fills certain fields in the PDF form with employee information stored inside a database, and then e-mails this partially completed form to each employee.

After filling out the rest of the form, an employee clicks the Submit to Laserfiche button and the form gets routed directly to the C:\pdfsubmission folder. From there, Laserfiche Import Agent imports the form into the \Human Resources\temp\submitted Open Enrollment Forms folder in the Laserfiche repository. The workflow pictured below runs and does the following:

  • Extracts the content of the form.
  • Stores the original file in a Record Series.
  • Stores the file shortcut in the specified employee’s folder.
  • Updates the employee database with the new data from the form.
  • Notifies the HR Manager by email that the form has been submitted and the database updated.

If an employee didn’t sign the form before submitting, Workflow sends the form back to the employee to sign and re-submit.

 

All of the files associated with this process, including the code and sample workflows can be downloaded here.

*Please note that a Support Site account is necessary to download the zip file.*

Related Posts