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

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….
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.
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?
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.
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.
This was incredibly helpful, thank you so much!
This is just what I needed – thank you for this helpful information.
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;
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.
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?
Have you tried the PDF Optimizer?
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.
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?
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)?