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.

mergemerge001

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.

mergemerge002

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.

mergemergesplash

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:

mergemerge003

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

mergemerge004

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.

mergemerge005

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:

mergemerge010

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.

Advertisements

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.

dmlots001

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.

dmlots002

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.

dmlots003

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.

dmlots004

This will show the Organize Pages toolbar.

dmlots005

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

dmlots005

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.

dmlots005b

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

dmlots005c

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

dmlots006

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

dmlots005

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

dmlots007

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.

dmlots008

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

dmlots009

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

dmlots010

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.

dmlots011

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

Of interest: New Data Merge techniques and quote bug

In the latest Colecandoo Youtube episode, four Data Merge specific features are covered, namely:

  • Adding faux-returns to a data merge field to split over lines, and subsequent limitations of this technique;
  • Using GREP styles to swap a character for a glyph during a Data Merge;
  • Highlighting field codes so that they are easier to see when not showing live data; and
  • A bug that occurs when a double-quote is at the start of any field in a Data Merge text file.

Faux returns within a field

The faux-returns technique is written about elsewhere, so rather than spoil their presentations, please read the articles directly from the appropriate sources:

I’m a fan of this trick, but emphasise that this is a workaround rather than a long-term solution, given that formatting is limited and there are more appropriate ways of accomplishing this task such as dedicated plug-ins or an XML workflow.

Swap characters for glyphs

Daniel Solis also features a clever trick to swap phrases with glyphs during a Data Merge that uses both GREP styles and ligatures. Again, rather than simply repeat the technique, please see his original video here.

A similar method can be employed using Indiscripts’ Indyfont script, but rather than swapping phrases with glyphs, will swap single characters.

Highlight Field Codes

The video also shows a method for highlighting field-codes when Data Merge is not in the preview mode. It relies on the [Basic Paragraph] style using a GREP style that contains a large highlight, and that any other styles in the document are based off of the [Basic Paragraph] style. It also means the document has to be styled correctly.

I’d demonstrated this technique following a real-world example of a live file where fields were very hard to see, and the file had to have an offset shell printed with variable data printed afterwards, so making sure the shell had no variable data on it was crucial. Using this technique would make finding the field codes much easier to see.

Double Quote bug

Also featured in the video was an issue that once again arose from a real-world example where a customer had provided a database that had double-quotes at the beginning of fields, but no closing quotes, resulting in rather unusual results.

 

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.

myscript

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.

surveyitself

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.

batchprocess

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.

exportoption

Method Three

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

proscript

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.

extscript

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: