Form Field Flattening in Acrobat X

While at Adobe MAX last week, I was asked how a user could flatten form fields with Acrobat X. Flattening form fields means removing the form fields themselves and placing the data onto the PDF as regular items. This is a common request for folks who want to “lock down” a form without using password protection.

A person who overheard the request chimed in with “just print it to a new PDF!” While correct, printing to PDF to flatten form fields is not optimal. If there are any transparent art elements in the PDF, for instance, they will be replaced with non-transparent “flattened” artwork. Any interactive content will also be removed and replaced with poster frames, if available. What, then, are we to do if we want to keep our PDF just like it was, but without any form fields?

Acrobat Pro can automatically preflight PDF documents using a robust and configurable preflighting engine. In addition, since Acrobat 8, it can also apply what are known as fixups to PDFs in addition to preflighting. Preflight profiles in Acrobat often contain only fixups, and we’ll use one of these fixups now.

With a PDF open, open the Tools pane and open the Action Wizard panel. Next, we need to create a new Action. Click the Create New Action button to open the Create New Action dialog.

 

The Action Wizard allows you to schedule a series of steps from a pre-determined pool of steps on one or more PDFs. All of these steps get bundled into an Action, which you can start by clicking the Action’s name in the Action Wizard panel. We’ll name our new Action later. First, we need to determine on what the Action will act. By default, Acrobat will start with A File Open in Acrobat. This will use the currently open file as the target for the Actions that are about to take place. You can also choose other sources, such as a file or folder to which you would browse, a scanner, or even let the user decide at the start. I’ll keep the default setting, since I want to be able to flatten form fields in a PDF that I am completing.

The Action Wizard allows you to provide instructions to users as well, and it’s a good idea to let the user know what’s going to happen. Click Add Instruction Step to add an instruction step. Enter a title for this step and also the text that will show in the dialog. I included the following: “This Action will flatten form fields in the PDf that’s open in Acrobat. It will not flatten form fields in an XFA (LiveCycle) PDF. When complete, it will save a new PDF with the word flattened inserted before the .pdf extension” Click Save to close the dialog.

Having given our user instructions, we can now choose the sequence of events. For this Action, we want to execute a Preflight profile. Acrobat X comes with a wide assortment of Preflight profiles, some of which contain only fixups. The one we want is called Flatten Form Data. To choose a Preflight Profile, open the More Tools panel and then click Preflight, which is at the top of the list. A Preflight step will now appear in the list under Action Start. To configure which Preflight Profile will be executed, click the Options button in the Preflight step. Having chosen the Flatten Form Data Preflight Profile, click Safe to save the step.

The last thing we need to do is to configure how the flattened PDF will be saved. I want the flattened PDF to go in the same folder as the original PDF, but with a new name to indicate that it has been flattened. To the right of Save To:, click the menu and choose Same Folder Selected at Start. Then, click the Options button to open the Output Options dialog. Choose Add to original file names: and enter “_flattened” into the Insert After field. Ensure that the output format is set to Save File(s) As Adobe PDF, and then click OK to close the dialog. You can choose to Overwrite existing files if you wish; it will not affect the original form.

Having configured the Action, it’s time to save so that we can use it. Click Save, and enter a name for the Action. I called mine “Flatten Form Fields” and entered the text from our alert dialog as the description. Click Save to save the Action, which will make it available in your Action Wizard panel.

To use the Action, open a PDF with Acrobat form fields that contain data. In the Action Wizard panel, click the name of your new Action. You will be reminded of what’s about to happen, and then you can click Next to proceed. You can choose not to show this Actions dialog again. Next, Acrobat will pop up our custom alert, and when you click Next, Acrobat will flatten the form data and save the new PDF. This new PDF will have all form data flattened onto page content and all fields will be removed. This is a great example of how Actions in Acrobat X can help get complex or obscure jobs done quickly and easily.

Share on Facebook

18 Responses to Form Field Flattening in Acrobat X

  1. larry says:

    hey…..one question……….I’m trying to automatize my pdf index catalog update …… guess what….the “build catalog” is not available in the so-called pre-determined pool of steps ….. what can I do? geez how something so simple could be turned into a user-hostile mess….

    • James Lockman says:

      You might want to look at the following help entry. It is in fact possible to automate indexing, but you will need to do that with a scheduling program outside of Acrobat.

  2. Alan Berry says:

    Great instructions, but I now have a problem:

    When I flattened my form, all the checkboxes for Dr., Mr., Mrs., etc. showed as checked! How do I prevent the form flattening function from corrupting check boxes?

  3. taskerus says:

    When I flatten form fields utilizing the preflight options, the check box form fields all toggle on. Any idea why or how to prevent it. The behavior severely limits the usefulness of the function. I’m using Acrobat X with CS6. Thank you in advance for any feedback.

    • James Lockman says:

      Hi, Tom and Alan.
      This appears to be a byproduct of using Preflight to do the form field flattening. As an alternative, you can execute one of the the following javascript commands rather than a Preflight Profile:
      this.flattenPages();
      or
      event.target.flattenPages();
      To use this step, delete the Preflight step and add an “Execute Javascript” step. Click on the options button and paste “this.flattenPages();” or “event.target.flattenPages();”(no quotes) into the Javascript editor window. Click OK and then Save, and you should be off to the races.

  4. Shauwea Hamilton says:

    This was incredibly helpful, thank you so much!

  5. CMW says:

    This is just what I needed – thank you for this helpful information.

  6. Gregg says:

    Hi James,
    Im new to the whole acrobat and scripting scene and wanted to know if it is possible to flatten a form, and email the flatten version, but have the original version unflattened?
    Ive started the email button that looks like this which I found on another website. This is run when the button is clicked and sets up the email from variable in text fields in the forum. This form has 3 buttons on it, 1 to print, 1 to email and another to reset the forum. I would want to also hide the reset button and the email buttons.
    Thanks in advance for your help

    // This is the form return email, It’s hardcoded
    // so that the form is always returned to the same address
    // Change address on your form
    var cToAddr = "formsAdmin@BigCorp.com";

    // Get the client CC email address
    var cCCAddr = this.getField("ClientEmail").value;

    // Now get the doctor email only if it is filled out
    var cdocAddr = this.getField("doctorEmail").value;
    //if(cdocAddr != "")
    //cCCAddr += ";" + cdocAddr;

    // Set the subject line
    var cSubLine = "Patient referral for "
    + this.getField("ClientFirstName").value + " "
    + this.getField("ClientLastName").value;

    // Set the body text for the email message
    var cBody = "Thank you for submitting your form.\n" +
    "Save the mail attachment for your own records";

    //** Send the form data as an XML attachment on an email
    // Build the email URL
    var cEmailURL = "mailto:" + cCCAddr + "?cc=" + cdocAddr + "&subject=" + cSubLine + "&body=" + cBody;

    // Function that actually sends data
    this.submitForm({cURL: cEmailURL, cSubmitAs:"PDF", cCharSet:"utf-8"});
    }
    //var Mail = "mailto:" + Mailto + "?Subject=" + SubjectBetreff + "&Body=" + MessageNachricht + "&cc=" + CC + "&bcc=" + BCC;

    • James Lockman says:

      With an Action in Acrobat XI, you can flatten the form via the PDF Optimizer, then save a copy. Then, it’s a button in Acrobat that fires off the workflow. If you need the person who filled out the form to have the flattened form as well as the fillable form, then you will need to take another tack. Have you looked here for a scripting guide for your version of Acrobat? Looking in the Acrobat 8 Javascript API, there’s a saveAs method you can use as part of your script. This would leave the original PDF alone, and also provide a method for flattening and saving via JavaScript in a button.

  7. Lou Kurrelmeyer says:

    I have amount fields on a PDF, editied with commas and dollar signs ($). When I flatten those fields, the commas, dollar signs, red for negative are all lost. I have tried excluding those fields from flattening, but the forms looks funny with the amounts changeable and everything else flat. Is there any way to flatten a number text form field where the dollar sign, commas, red for negative and parenthesis for negative are preservered?

    • James Lockman says:

      Have you tried the PDF Optimizer?

      • Lou Kurrelmeyer says:

        I just did. Got a peculiar result. Some of the number fields retained dollar sign and comma edits and some did not.

        I guess flatten is never going to preserve numeric editing.

        I think I am going to have to format the numbers in my application and feed them in as text strings. I was trying to avoid doing that. I lose the ability to make negative amounts red that way.

        Thanks for your answer.

  8. Alain Boisclair says:

    I have a problem with the preview app of mac when i open a flatten form. In acrobat, it look perfect. In preview the information is double in the fill field. .

    Any idea what it could depend of?

    • James Lockman says:

      Different PDF readers interpret the form layer differently. Preview does not use the same PDF Engine as Adobe, so how it displays form content is likely to be different. When you say double, do you mean that the words appear twice, but overlapping (false bold), or to you see words or letters repeated (rreeppeeaatteedd lleetteerrss or repeated words repeated words)?

  9. Ryan says:

    FYI: I tried, but it was a protected doc from my real estate agent. I needed to sign on my smart phone and it wouldn’t take with it being a protected form. I had to get hardcore on the file and print to Microsoft XPS to flatten then convert back to PDF. Protected PDF’s can be difficult to export or convert to another PDF, so as long as you can print it and you have access to another virtual (non-acrobat) printer you can apply the workaround.

    • James Lockman says:

      Yes, this is why they are protected, to prevent you from doing what you want with the PDF. Printing is not always an option, though, as not all protected PDFs allow printing.

  10. Peter Riva says:

    All this advice is off target. I tried responding to discussions (after I signed in) but there was now ay to help people with the solution.
    Problem: ANY e-mail @ symbol in Word will be interpreted in Acrobat X as an e-mail address. You CANNOT stop this no matter what your preferences are (hateful programming). If you have an e-mail address with an underscore or hyphen then Acrobat will drop ANYTHING before the underscore or hyphen, directing your users to a dead mail box. This is anti-business Acrobat by the way. Acrobat does not allow editing of embedded hypertext links. Again a program failure.

    SOLUTION: In Word, instead of a hyphen, use Control+Alt+hyphen and then Acrobat is FORCED to treat the e-mail address as one. I do NOT have a solution of underscore.

    • James Lockman says:

      I’m not sure how your comment relates to form field flattening, but I will help you with your issue. You can turn off Acrobat’s and Reader’s automatic link recognition in the Preferences>General section. Look for “Create links from URLs” and disable it. You may not be able to edit hyperlinks if you do not have Acrobat. Adobe Reader does not have the tools to edit hyperlinks. Acrobat has a very robust set of tools to edit hyperlinks and other interactive content. Open the Tools panel and then open the Interactive Objects section. Choose the Select Object tool, which will reveal all of the hyperlinks that Acrobat has auto-generated. You can then select the one you want to edit, right-click and choose Properties. Under Actions, click on the Open a Web Link item and click the Edit button to edit the address.