Change the background highlight of PDF form fields in a document

During the CreativePro conference in New Orleans, a question was raised during Chad Chelius’ session about Designing forms in InDesign and Acrobat: how to change the background highlight colour of the fill-in forms within Adobe Acrobat. It is possible to change the value of that colour via the Highlight Colour from the preferences panel, but this is an application-wide change, and changing the colour in one form will change the colour for all documents that are opened thereafter.


This will also only change the colour on the viewer’s PDF, not the PDF itself.

Luckily, it is possible to change the colour via scripting that will affect the current form but leave others alone. Take the following example – in this form, I would like the background to be grey, rather than the default blue:


Open the PDF that needs the background to change and open the page thumbnails panel. Right click on the page and select the page properties item.


In the new dialog, go to the Actions tab at the top right, and then add two actions: on Page Open, run a javascript, and on page close, run a javascript.


Click on the Page Open Run a Javascript selection and click edit, and in the new window, type the following and click OK.


Click on the Page Close Run a Javascript selection and click edit, and in the new window, type the following and click OK.


Repeat adding the page level scripts for each page in the PDF. This example has one page, but for a four page PDF, this would need to be done on each page of the PDF.

Save and close the PDF. Open the PDF again and the background has now changed to gray.


The two javascripts work by saving the current application preferences into memory, and then changing the preferences until the document is closed, and then reloads the original preferences.

The background of any PDF form opened will now be gray until the PDF is closed, so close the PDF and open another PDF to confirm that the background returns to normal.


If you would like colours other than gray, the javascript syntax for the colour can be found here:

A similar technique is shown in this article in the Acrobat Users forums.




Data Merging to specific pages

I was recently faced with the following brief:

I have a database that need to be run through the Data Merge to Single Record script. Some of them need only page 1 and some need page 2. Is there a way to add another column in the database and let InDesign know if it should export page 1 or 2? 

My original thoughts were that this could not be done, but then I realised there is a new feature added in Adobe InDesign CC 2018.1 to the PDF export: Create Separate PDF Files.


I decided to create a new PDF export style and ensured that the Create Separate PDF Files checkbox was turned on, and make sure that the numbering is based on page numbers.


Wondering if this would work, I created the following scenario – thank you graphics to be emailed to contributors to this site, based upon three available contribution values. The InDesign file is 3 pages long, has two different page sizes, and is linked to a Data Merge of 1,000 records that has – among its fields – a field called “Variable” that has one of 3 values in the field – 5, 10 or 25. Page 1 is the five dollar campaign, page 2 is the ten dollar campaign, and page 3 is the twenty five dollar campaign.


For the sake of this demonstration, I’m going to try with records 1-25. Running the Data Merge to Single Record script available from the downloads or scripts pages of this site, I make sure that the variable field is part of the filename, but ensure that it is the last part of the filename:


I let the script run, and then once complete, the Results folder appears as follows:


So right now, there are myriad folders and files, so this looks like a complete mess and failure. However, using the search function at the top right of the finder window, I’m able to find what I’m after. I’d like to find all of the five dollar PDFs first, so I type in 5_01.pdf into the search field, ensuring I’m searching on the Result folder. Why 5_01.pdf? Well, the 5 was the variable in the variable field, and 01 was the page number associated in the InDesign file to the five dollar campaign.


So this found 11 records. I’ll move those records into a folder elsewhere and look for the other PDFs in a similar fashion: 10_02.pdf and 25_03.pdf

I now have all the records required, and can remove the remaining records from the Results folder, so that’s great for creating single page PDFs by using one InDesign file for multiple campaigns.

Modifying the technique for JPG or PNG

If I want the files as JPG or PNG instead, I could use the Data Merge to Single Record script and merge to InDesign files without splitting the files into single records, and then use Peter Kahrel’s Batch Convert script to export to JPG or PNG.

It is then possible to perform a similar search that was used to separate the earlier campaigns.

Doing the modified technique in less steps

Or, if you want to run one script instead of two, perhaps consider having a look at the Data Merge to Single Records PRO version:


Run the script and then perform the search that was used to separate the earlier campaigns.

If you’re interested in the Data Merge to Single Records PRO version, please contact me via the contact page.

Another Data Merge script: Data merge to batches

This latest script compensates for a feature that should be available in InDesign’s Data Merge feature, but simply doesn’t work.

The problem:

Take for example the following Data Merge file where we want to export a custom range, but prepare PDFs in batches of 50s for production purposes. Each record is one page long.


When the Data Merge feature is used in Adobe InDesign, it is possible to merge to several new InDesign files that contain a maximum amount of records per file. The same dialog box is present when merging directly to PDF as well.


Unfortunately, the Record Limit per Document checkbox may as well be there for decoration, because it doesn’t work. Instead of 13 PDFs being created with the maximum size of each PDF being 50 records long, a PDF the size of the complete merge file is created.


The workaround

It is possible to split the document into ranges 50 pages per PDF, but it has to be done in Acrobat. From here, click the Organize Pages button.


This will show the Organize Pages toolbar.


From here, click on the split icon to show the split pages portion of the toolbar.


With the split pages toolbar now visible, choose the appropriate split by dropdown and edit the amount required. In this case, we need “number of pages” and 50 pages.


The files now need to be saved somewhere. Click the Output Options button to show the Output Options dialog.


Select a destination for the files and any additional filenaming information and click OK.


Once back at the regular toolbar, click the big blue split button.


The task will run and then present a dialog box once it is complete.


On an example such as the one demonstrated, this isn’t an onerous task. However, if working in a production setting where PDF page lengths can be tens of thousands or longer, this is inconvenient and unacceptable.

The solution

Rather than use the Adobe Acrobat solution, I would prefer that the original dialog box worked correctly. One option is to let the Adobe InDesign Engineers know that it should be fixed. A link to the direct request can be found here.

Until it is fixed, I’ve written a free script specifically for this purpose.


Using the earlier example, the same settings will be keyed in.


Once keyed in, click OK. A progress bar will let you know how the merge is going.


An alert will let you know when the merge is complete. The files are then saved to the selected destination with no extra splitting required.


Interested in this script? It can be downloaded from here.

Data Merge to Uniquely-Named INTERACTIVE PDFs

In this episode of Colecandoo, I’ll demonstrate several ways to data merge to uniquely named interactive PDFs. The first method uses the data merge to single records script that I released in 2015 and can be downloaded here.


This demonstration features an InDesign file that is a survey for a package tour company. It contains form elements such as check boxes, radio buttons, a combo box, text box and a submit button. It is also a Data Merge document and contains two text fields within the first paragraph.


With my script, this should be a simple task, but as I click on the PDF export preset dropdown, I notice that I don’t have an option for interactive PDF. Why is this? Well put simply, the script works by calling upon the two ways that a Data Merge can normally be exported – to a newly merged InDesign file, or to a PDF.

As described on Colecandoo before, PDF export from Data Merge is neither a print PDF nor interactive, but it’s own style. Read the full article here.

Method One

But I said it could be done, so what’s the trick? Ultimately, we have to run my script to merge to InDesign files first, and once the folder of InDesign files is generated, use another script from Peter Kahrel, namely BatchConvert.


This script is an amazing utility created by Peter Kahrel that I have written about for InDesignSecrets. It takes a folder of InDesign files and can convert them to a variety of formats, including – for our purposes – interactive PDF. Simply point the script to the folder of InDesign files that were made initially, then point the script to a folder where the interactive files should save save to. Choose the output option as PDF interactive, and then run the script. That’s the first way.

Method Two

The second method is identical to the first method in that files are initially merged to InDesign files, and again uses the batch convert script. The difference is that rather than export to PDF interactive, files remain as InDesign files. Instead, there is a checkbox at the bottom of the user interface that allows another script to run during the batch. From here, I’m going to choose a script I’ve written for this express purpose – it will create an interactive PDF with the same name as the ID file but will save it to a folder called interactive PDFs on my desktop. So that’s the second method.


Method Three

The third method demonstrates a sneak-peek at the PRO version of the data merge to unique names script.


The interface doesn’t look too much different to the previous script, with one exception – the option to run a script during an InDesign export. From this new option in the user interface, simply select the script that I used in method two. Choose some fields for the filenames, the range, and click OK. That’s the third method.

Method Four

The last method demonstrates a sneak-peek at another alternate version of the data merge to unique names script. Unlike the other methods shown, this method is by far the most direct, as it adds “PDF interactive” directly to the user interface.


To accomplish this task, choose the save location, choose the “PDF interactive” radio button, choose some fields for the filenames, the range, and click OK. That’s the fourth method.

Sidenote about Document Fonts

One issue not addressed in the video is the issue of potential font substitution while creating the interactive PDFs. This comes about because all four techniques rely on creating an InDesign file first that is removed from the original merge file, and may not have access to the fonts used by the original merge file. I’m running Extensis Suitcase font management software so I know the fonts will always be active until I turn them off, but for those relying on other solutions such as the Document Fonts folder, beware of this issue. I’ve written about this for InDesignSecrets.

An added bonus

One thing about the PDFs made during the demonstration was that the text in the dropdown field didn’t suit the formatting of the survey. Formatting of text-related form fields can’t really be controlled in InDesign except for the point size. However, I’ve made an Acrobat Action that I can run not just to this file, but all files in a folder. This action will convert the font in the text and combo boxes to Helvetica and make them 12 point. It’s worth noting that while it’s possible to change the font to whatever is on your system, other users may not have those fonts, so be conscious about this before using the action. Helvetica, Times, Symbol and Courier are present in Adobe Acrobat.

I’ve made this Acrobat Action available from my downloads page as well.

For those after a more robust solution, perhaps consider Form Magic from ID-Extras.

So there you have it, four ways to create uniquely named interactive PDFs from Adobe InDesign. If you’re interested in purchasing the upgraded versions of the data merge to unique names scripts shown in this video, contact me directly via my contact page.

%d bloggers like this: