Centering “fit frame to images” using InDesign CS6

UPDATE 2020/01/02 – Since the release of InDesign 2020, new methods have been added to InDesign’s Data Merge content placement options. However, this article will remain for posterity.

In mid February, a post on the Adobe Forums asked the question:

I’m using Data Merge to place a single image on each page.  I have the frame centered on the page and its reference point set to the center.  I have the Data Merge options set to “Fit frame to content”, but when I run the merge all the images align to the top left corner of the frame.  The frame expands or contracts as directed, but I would like for it to expand from the center.  What am I failing to do?

The question was answered:

It doesn’t work for “fit frame to images” – instead the frame fitting options take the measurement from the top left.

Image fitting options in Data Merge are explored in greater depth in the “Merge Right” article in issue 52 of InDesign Magazine. Ultimately, there is a checkbox in the Content Placement Options dialog box of Data Merge that is misleading – it is the “Center Content” button. This button centres the content within its frame, but not the frame to its relative position on the page. For most of the fitting methods, this is fine, but for the “fit frame to images” option, the frame size will change whenever the image size changes, and when it does, the image resizes from the top left of its position on the page, rather than from the centre point of the image.

A solution was provided to the poster along these lines:

  1. Create a text box larger than the largest image that is part of the merge. Align the text to be centered not only left and right, but top and bottom (from the text frame options). If done correctly, the flashing cursor should be in the center of the textbox.
  1. Draw a new graphic frame and assign the image field of the data merge to the frame.
  2. Cut and paste it into the textbox. If done correctly the box should be centered within the textbox.
pic3 merged
  1. Make sure that Image Placement dropdown of the Content Placement Options from the Data Merge panel is set to “fit frame to images”

The solution is also flexible in that the image can be aligned to left, center or right horizontally, and/or top, center or bottom vertically.

pic4 merged

The solution works… provided the text box is big enough for the images within the data merge… otherwise the item becomes overset and the image disappears.


It is also a somewhat clunky solution as it means having a large textbox in the document simply to position an image.

An alternate solution would be to draw a larger than normal frame with the “Center Content” turned on using the “preserve frame and image size”, but if the content was to have an outline on it then this solution would not be appropriate.

pic6 merged

However, CS6 introduces a new text frame feature called auto size. This is handy for not only making text boxes fit the type only, but for creating minimum sizes and allowing the box to “grow” when more text is added, based on the auto-size instructions in the options.

Using this new feature, we can take the earlier solution and apply the auto-size to the text box that is housing the now inline graphic. I can now also control where the image “grows” from using the auto-size instructions, rather than using the text alignment features of the text box.


The other great feature is that I can use anchored objects with this image too… something that I could not normally do with an image frame as anchored objects can only anchor to text frames. In this case I’ve added a fancy caption bar that uses anchored objects of its own to grow/shrink the caption as the data comes in.

pic8 merged

So scrolling from record to record, I can see that the images are indeed starting from their reference point in the auto-size dialog box, and that the caption anchored object is always staying in its position at the top right of the picture.


When merged to single page merges, this trick works fine… however when I merge to multiple records per page… it goes haywire.


Despite this bug, this trick is also handy even if data merge isn’t being used. As a snippet or a library item, as not only does caption stay in the same relative position to the image regardless of where the image is moved, but there is more flexibility as to how the caption can be positioned or designed.

The file used for this article can be found here. To keep the file size down, the original links have been removed so that substitute the links and merge file can be used to try this out.

Data Merging now a headline act


The February/March 2013 issue of InDesign Magazine has a new contributor: Me! Yes, this issue has a 12-page special feature about Data Merge, written by yours truly, and features the five essential techniques for using the Data Merge function within Adobe InDesign.

Sadly, no spoilers I’m afraid. If you want to read the article in full, along with all the other useful and must-have information in this issue, you need to go to InDesign Magazine’s site.

Effects plus live type equals effective VDP

Variable Data Printing (VDP) campaigns can be a great way of not only targeting a particular audience, but also getting their undivided attention. Sadly, much of the marketing utilising the latest and greatest VDP technology to target their audience are still relying on the old-fashioned greeting “Dear your name”.

While this blog isn’t a guide to marketing and nor does it profess to be, I just think that with the technology available in Adobe InDesign’s Data Merge, do VDP campaigns have to be stuck in the 50s style “Mad Men” campaigns?

In the past, the blog has demonstrated how to make contemporary campaigns with salutations displayed as:

  • Pencil-case letters
  • Scrabble letters
  • As part of a cartoon
  • Name badges
  • Street signs

Some of the samples use complex Excel files to break up names into individual letters to create the merge, but others use nothing more than live type to spice up the delivery of the reader’s name. On that note, if type can have an effect applied to it, then any VDP campaign can be taken to the next level.

For this post, I’ve just created a simple example using two live effects: One to look like writing in beach sand, and the other to look like clouds.


Admittedly applying both techniques to one campaign is overkill but the point is to illustrate that so long as effects can be applied to the live type, then creative effects like these can present the reader’s name in a more attention-grabbing fashion. The PDF (that contains all assets that made the PDF) can be downloaded here.

Effects that can be applied to live type are limited in InDesign. Effects such as distortions are limited to type on paths, the gravity effect (as applied on the sample) and the “square peg round hole” trick that can be found elsewhere on this blog. Other effects such as bevel/emboss, outer glows, drop shadows, feathers and satins are still available, as well as how they are applied to the layout such as the multiply effect, screen etc.

One individual who seems to make all text come to life is Mike Rankin who has a regular blog on known as InDesign FX and has other material on the website. Also bringing these campaigns to life is the use of fonts that suit the effect being applied… that is for the beach sand example I decided to use a font that would look like a child’s handwriting as opposed to a serif or sans-serif font that is more appropriate for a letter or book.

I have recently found inspiration from the youtube channel Vsauce that has a regular episode titled DONG: an acronym for Do Online Now Guys. In a recent DONG, host Michael Stevens recommended the site, a site for creating one-to-one web to jpg pictures. The site provides ideas – not always original – for VDP campaigns… but sometimes inspiration comes from the strangest places.

The bottom line: targeting a market is one thing, getting their attention is another. InDesign’s Data Merge can be a powerful tool for VDP campaigns, don’t limit communicating with clients with the old and tired “Dear your name” greeting.

Live Text Masking in InDesign

Until now, to make a text-mask with InDesign, type normally has to be converted to curves so that the type can now be treated like a placeholder. This works fine until the type has to change, such as:

  • Correcting a typographical error;
  • Including more text or resizing it; or
  • During a data merge.

In these instances, it would be ideal for the type to still be live so that changes could be made while maintaining the masking of the type.

Surely someone had thought of this before… but instead of being an easy search in Google, it took hours of research to find this little nugget of information from the Phoenix InDesign Users Group:

Excited, I followed the instructions to the letter, but discovered that this trick isn’t true text masking. Let me explain.

A text mask created the usual way of converting to curves and then placing the image within the new shape works this way:

However, a text mask created using the tutorial from the Users Group behaves more like a stencil. That is, it does mask the image, but shows the stencil:

This is fine if the background is white… but in this instance the background is pale yellow. The solution in this instance is to make the image to be masked sent to the background, and the image which is in the background become the foreground:

So while this technique works, it does not work as well as masking within shapes, given that:

  • not all effects (drop shadows, bevels, transparencies) can be applied to the masked text; and
  • the background effectively is brought forward; and the item to be masked is effectively in the background.

This technique also works with background images. To demonstrate this, I’ve upgraded an earlier post featuring “Square Pegs Round Holes” to demonstrate how this masking works with live text.

As usual, files for the above demonstration can be found here.

Swapping paragraphs during Data Merge

A recent post on the adobe forums raised an old question which I’d been happy to consign to the too-hard basket, and that question was how to import text as part of a data merge. While text can’t be imported into a merge à la importing pictures into a data merge (i.e. can import image files such as JPG, EPS, PDF, TIFF… but not text files such as DOC, RTF etc) I knew there had to be a workaround.

The workaround came in the form of using a field from the data merge to trigger a GREP style. To demonstrate this, I have created an example in the form of this case study:

An electronics store is preparing a mailing of its statements, along with a with compliments slip which is specifically targeted to each customer. The store has prepared a database with an ID to correspond with the statements, the client’s first name, and a code that corresponds to the campaign, which happens to be:

  1. Good payers
  2. Online shoppers
  3. Recently filled out an in-store survey
  4. Long time customers
  5. Dormant customers
  6. Due for a phone upgrade

Each merge has its own text, so the typical way of handling this would be to perform six separate merges, but because the with compliments slips have to go with statements that are printed in ID order and the client does NOT WANT the ID to appear on the with compliments slip, the merge must be prepared once and in order, so this is not an option.

Instead, I have created an InDesign file with two layers – a base with the static data, and then a layer that I have labelled 1 (to represent the good payers). For now, the text for the first campaign is added, along with the letters |xxxx| at the start of each paragraph, and the text is formatted using a paragraph style called changingpara1 – so far, it contains nothing out of the ordinary… yet. This will make more sense soon.

The other campaigns are literally duplicates of layer “1” but named appropriately (2,3,4,5,6) and contain their appropriate content. For the ease of creation, only the base and layer being made are viewed at any time. Until the data is imported, I’m just using first names.

Using the data merge palette, the data “namesdb.txt” is imported, and the |xxxx| portions are replaced with |<<number>>| but still retain their “|” at the start and end of the field code. Again, for ease of working with the layers, only the base and layer being made are viewed at any time.

As Heston Blumenthal would say… this is where the magic happens. With no text selected, two character styles need to be created:


  • Horizontal scale to -1, and
  • no fill nor stroke


  • Black fill only

Now, viewing only layer “1”, the text box is selected and the paragraph style assigned to it is changed, namely:

  • No fill nor stroke, and

  • GREP styles

apply Black style,

to text: ^\|1\|.+

(this will find the start of the line and |1| followed by everything in the paragraph)

apply Hide style,

to text: ^\|1\|

(this will find the start of the line and the |1| only so it can be hidden)

But something unexpected has happened… the type has disappeared! This should happen… so far… pushing on, view only layer two, click on the textbox and in the paragraph styles palette, duplicate changingpara1 BUT change its name to changingpara2 and change the GREP styles this way:

apply Black style,

to text: ^\|2\|.+

(this will find the start of the line and |2| followed by everything in the paragraph)

apply Hide style,

to text: ^\|2\|

(this will find the start of the line and the |2| only so it can be hidden)

Repeat this for the remaining layers, so that layer “3” text has the “changingpara3” paragraph style that, in turn, has the GREP styles which show/hide text with the letters |3| at the start of the paragraph, and so on for the other layers.

After doing this, make sure all the layers are visible and turn the “preview” on the Data Merge palette. Suddenly, the text seems to come to life, responding to the values in the “numbers” field.

The picture above represents the records in the data merge and how they change from record to record. Alternatively, watch the video of how a similar campaign was assembled:

As usual, all files associated with this demonstration are available in the merged PDF file which can be downloaded here.




“No fills” GREP Styles – Part 2: The Glitch of the Merge

This is part 2 of the “No fills” GREP styles articles. In this post, the “No fills” GREP Styles are used to overcome a Data Merge glitch within InDesign when the “remove blank lines” checkbox is selected. An example has been created which contains an Email, Direct number and Mobile number. Here is how the file looks without any data in it.

Here is how the file looks with the first record.

Good so far. Won’t win any awards, but all the fields are populated. How about the next record?

Now there is an issue. There is no number for the Direct field but the word Direct implies that there is. This looks untidy, it would be good if this line would disappear.  “Remove Blank Lines for Empty Fields” should solve this.

OK, this hasn’t solved the situation. It must consider the word “Direct” to be content of the line, regardless if there is data or not. What if the prefixes (Email, Direct, Mobile) weren’t in the type as such but were bullets for example? Easy enough to make them using Paragraph Styles, so this will be demonstrated using the Email field. This will be done on a new page to compare results.

This Paragraph Style will be duplicated twice to make styles for the Direct line and the Mobile line, with the prefix being the only thing to change amongst the Paragraph Styles.

So this should work. How does the first record look?

Good. How about the second record?

Excellent. The word “Direct” has disappeared as intended and the Mobile line is now underneath the Email line. How about the third record?

Bad. The line which should start with the word “Direct” now starts with the word “Email”. It is almost as if InDesign’s “Remove Blank Lines for Empty Fields” feature has deleted the line but inadvertently taken the Email line formatting. This is a glitch, but occurs during the preview only.

However, it could be a costly glitch, especially if the glitch is inadvertently triggered via the Preview.

So is there an alternative way to do this so that this issue is avoided? GREP Styles. Again, this will be done on a new page to compare results.

The following character styles need to be set up. Apart from the font type and size, the settings required are as follows:

STYLE Firstword White nothing
General Based on [None] Based on [None] Based on [None]
Character Colour Fill: Red Fill: Paper Fill: None

Now the following paragraph styles need to be set up. Again, apart from the font type and size, the settings required are as follows:

STYLE Lines Direct disappear
GREP styles Apply: nothing

to text: ^\+.+

Apply: nothing

To text: ^1800.+

Apply: white


Apply: firstword

To text: Direct\t(?=\+|\d)

Character colour Fill: Paper Fill: None

Set the text so that only Email and Mobile have their prefixes showing, but with the placeholders in place. Note the position of the “Direct” field – this is on purpose.

Next, copy and paste in place the text onto a new layer. Format the text so that the first line is a hard return and that the next line is formatted as pictured.


Once done, begin with record one

That worked. How about the second one?

Good, but the third one fouled up before. Is it good now?

FINALLY! How about record nine… this doesn’t start the way the other numbers do

FANTASTIC! The GREP style took this into consideration when it was created.

Yes, this example is not a turn-key solution to EVERY Data Merge glitch, but the use of “no fill” GREP styles can be, provided the GREP styles are carefully tailored to the situation. This post is simply to demonstrate the power of GREP styles with “No fill”.

As usual, all necessary files can be found as attachments within the PDF of the file here. The PDF was made prior to “activating” the glitch, but can easily be done in the InDesign file by toggling back and forth through pages in the Data Merge preview.

“No Fills” GREP styles – Part 1

In a previous post, GREP styles were applied to a data merge to correct the casing of surnames which had been exported incorrectly from a database. In this post, those GREP styles will be built upon to demonstrate how to combine GREP styles with the use of “no fill” as a character style. In Part 1 of this 2 part article:

To fix a salutation line in a direct mail campaign.

This example is a direct mail campaign in the form of a letter which contains a name, address and “Dear” line. The client has no specific field for the “Dear” line but would like such a salutation. However, the “name” field for the database actually contains:

  • Surnames prefixed by any of the titles Mr, Mrs, Ms, Miss or Dr;
  • Business names; or
  • No name at all

For the majority of records, the salutation will read correctly, such as:

Dear Mr Jones,

However, in the instance of a business name in place of a person’s surname, the salutation will look like:

Dear Bunnings Warehouse,

Which is ridiculous. The intent of the campaign is that the letter is meant to be read by the head of a household or business, so any business letter should be addressed to “the business owner”. Finally, some of the records are just addresses with no name and displays as follows:

Dear ,

In instances like this, it is not known if the letter is to a business or individual, so in these circumstances the salutation should be completely dropped. The usual solution:

1)   Do nothing. The old adage “Garbage In, Garbage Out” is usually adopted, resulting in unusual and clearly stencilled letters for any business or unnamed mail.

2)   Microsoft Excel. An additional field would be created using if statements based on properties of the name field. This solution works if the Excel file supplied will only be supplied once, but if the file may be supplied over and over again, this ultimately results in double-handling.

The InDesign GREP solution.

The solution is to apply a paragraph style with several GREP styles which detect if a letter is to a business or unnamed entity and change its appearance to either become “To the business owner” or drop the line completely.

The paragraph style is only applied to the salutation line and nowhere else. The salutation in InDesign appears as follows:

Dear <<name>>, To the business owner

So why are the words “To the business owner” on the line? They are perfectly visible at the moment and the line looks worse than doing nothing. Well, this is where the magic happens using GREP styles. Five Character Styles need to be made and in this example they are:

  • business
  • dear
  • upper
  • NOTupper
  • vanish

The properties for the Character styles are outlined in the table as follows:

STYLE Business Dear NOTupper Upper vanish
General Based on [None] Based on [None] Based on [None] Based on [None] Based on [None]
Basic Character Formats Tracking: 0 Tracking: 0

Case: Normal

Tracking: 0

Case: All Caps

Tracking: 0

Case: Normal

Advanced Character Formats Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Character Colour Fill: Black Fill: Black Fill: Black Fill: None

These styles then need to be applied within a Paragraph style using GREP styles. For this example the style is called “text”. Apart from the Basic Character Format dialog box of the Paragraph style, the other details need to be entered:

Advanced Character Formats – Horizontal Scale: 1%

Character Colour – Fill: None

GREP Styles – The following styles need to be applied to the following text searches in this order:

Order Character to apply Text to search for
1 Business To the business owner
2 Vanish Dear , To the business owner
3 Vanish Dear\s(Mr |Mrs |Miss |Ms |Dr ).+
4 Dear Dear\s(Mr |Mrs |Miss |Ms |Dr ).+(?=To the business owner)
5 Upper (?<=Mc)\l
6 Upper (?<=\u’)\l
7 Upper \b\u\l+\-\l
8 NOTupper \b\u\l+-(?=\l)

Once made, this paragraph style has to then be applied to the Salutation line. The result will turn this:

Into this:

As usual, a PDF containing an InDesign attachment of this example can be downloaded here.

In Part 2: Using “No Fills” GREP Styles to correct a Data Merge “Remove Blank Lines” bug.

“Warped Perspective” on merging: combine three applications?

As regular readers of my blog may be aware, I am a huge advocate of Adobe InDesign’s Data Merge feature. I consider it a truly under-rated feature and one capable of many creative VDP campaigns.

There are issues which I would like to see resolved, but workarounds are possible:

Issue Workaround
Not being able to export PDFs in “bundles” e.g. sets of 50, or single pages. Post-processing the PDF through Acrobat 9 or above using the “split documents” feature.
Not being able to import specific pages from a PDF. Pre-processing the linked file to be broken into single pages via the “split documents” feature in Acrobat 9 or above; or extract as single pages in earlier versions of Acrobat.
Not having a “next record” feature a la Microsoft Word’s “mail merge” function during mailing labels or catalogues which have a “next record” field which allows text to flow into the same textbox rather than in a separate created textbox via the multiple records per page feature. Post-processing a merged InDesign file using Rorohiko’s Autostitch plug-in, and then manipulating the textboxes to fit appropriately.
Not accept Microsoft Excel files as a database for a Data Merge. Pre-processing the Excel file to be saved as a TXT or CSV file.
Besides identifying images and type in the data header row using the “@” sign, Data Merge doesn’t parse the information in the database (doesn’t know if it is a date, dollar value, surname, postcode, if it relates to items on the page, etc). Treat the Excel file as the “Engine” which can apply limited display formatting (e.g. put dollar signs for currency values) and also apply formulas.

However, there is one issue that I cannot resolve: being unable to integrate with similar data merging features of Illustrator or Photoshop which allow Data Driven Graphics (DDG) but have different rules for construction.

When creating VDP campaigns which go beyond the normal stencil letter, it would be great to use effects on live text such as warp or perspective, but that  simply isn’t possible because InDesign cannot distort type to the extent that Illustrator or Photoshop allow. So if the design could not be done with InDesign, perhaps the effect could be created in Illustrator or Photoshop, and imported into InDesign as an image.

While both Illustrator and Photoshop have similar functions to InDesign’s Data Merge, the method of creation is different, if not complicated. Photoshop behaves like InDesign and references either a TXT or CSV file, but Illustrator will not – instead, it references an XML file.

Wondering if there was any insight to this dilemma, I prepared this post on the Adobe InDesign User forums. At the time of writing this Colecandoo post, the Adobe post is unanswered:

In recent posts, I have overcome variable pictures by creating individual graphics for each letter and then using some clever spreadsheets to determine what picture needs to be used for each letter. This only works however if:

  • The type is fixed width. In the recent post featuring scrabble squares and pencil-case letters, the letters were effectively rectangles of a consistent size. If the type had proportional widths, it would need to have its kerning in tact, this solution would not be possible.
  • The type used uppercase English letters and little else, such as a space or dash. Preparing a similar solution for other European alphabets, never mind asian glyphs, would require many more graphics to be made.

Ideally it would be grand of the three CS applications would “talk to each other” so that, for example, Illustrator or Photoshop could create a file which understood that it had a data field, and be saved so that once placed in InDesign, the data field could be referenced by InDesign’s Data Merge function. I don’t understand why three applications which behave similarly on many levels, behave so differently in terms of creating variable data.

There is third party software which currently allows visually rich VDP like this to take place, but the price of the software is restrictive and only available for larger suppliers of media.

Street Sign merge – revisited

In a recent blog post, I outlined several ways of preparing Data Merges which are beyond “Stencil Letters”. One of which was in my way a tribute to my favourite band “Parkway Drive” by creating a Data Merge which would create unique street signs.

While the concept works, it is, well… boring. The background is a solid blue purely to mask the green street sign underneath. After some contemplation, I wasn’t satisfied and wanted to improve on the concept by making the same sign variable over a complicated background. It took a while of thinking until Mike Rankin (of had the solution: Knockout Group.

Using the same template, the blue background was replaced and a more complicated image put into the master page. The blue “masks” were then made white with a fill set to multiply (they are outlined in red in the pic to see where they are).

The three strips in the background which made up the background of the street-sign were grouped. The text which contains the now “white multiply masks” was then grouped with the background of the street sign.

And all it took was one magic button in the effects panel to make the effect work: Knockout Group.

And voila!

As usual, a PDF of the merge as well as InDesign file and links can be downloaded here.

Going beyond “Stencil Letters”…

I find that the Data Merge tool is one of the most under-rated features of InDesign and most tutorials which one can Google on the Internet relate to either making business cards, old-fashioned mail-merges a la Microsoft Word, or rather rigid-looking catalogues.

However, once the Data Merge tool is combined with either clever spreadsheets using Microsoft Excel, GREP styles, anchored objects and applying features from the Effects palette or Object Effects, the Data Merge tool becomes much more powerful.

In previous posts I’ve done exactly this to create:

In this post, I will demonstrate how to make more interesting campaigns using Data Merge. Examples include:

  • Street Sign
  • Speech Bubble
  • Pencil Case letters
  • Scrabble Letters

In all of the following examples, the database names:

  • were between 3-11 letters long;
  • were English letters (no letters with accents, umlauts, cedillas, etc). Examples 3 and 4 are possible with foreign letters but would involve more steps not shown in this post.
  • were whole names (no spaces or dashes). Spaces and dashes are possible but in examples 3 and 4 would involve more steps not shown in this post.


The easiest of the four examples, the principle for this merge works using 3 things

  • a blue background with a blank street sign running along the entire page;
  • a centered text block above the street sign;
  • two anchored object images: the pole plus some blue sky; and blue sky tapered on an angle.

Put simply, the centered textbox contains the mergefield plus the word “ST”. This sits above the street sign and one anchored object (the pole plus the blue sky strip) goes to the left of the mergefield, and the other anchored object of tapered blue sky goes to the right of the mergefield.

The result is as the name changes, so does the position of not only the pole, but where the street sign ends, resulting in a dynamically made street sign which is always centered in the sheet.

Download the Street Sign PDF (which contains the InDesign file as an attachment).


This works on a similar principle as the street sign, but because anchored objects always go in front of the textbox they are pasted into, two textboxes have to be made: one containing the variable data (in white) plus the parts of the speech bubble which have to expand; and another containing the variable data only in black in the textbox above.

All works well with this design until the merge comes to the record of Christopher, where gaps appear between the plain rectangle and left/right of the bubble. To compensate for this, a GREP style was made to the type in both textboxes so that once there were 11 characters, the character style became scaled. This is much like the trick used in a recent post, the Square Peg in a Round Hole.

Download the speech bubble PDF (which contains the InDesign file as an attachment).


This was MUCH HARDER given that:

  • The letters were not fixed width, so each “letter” had to be in its own merge; and
  • Pencil case letters do not usually have blanks all the way to the end of the plastic inserts.
  • The letters are right aligned

To do this one, the first thing was to make the letters A-Z. This was done by making an InDesign file 26pp long with the design on the master page containing both the background and the letter as alpha page numbers. This was then made into PDFs which were split into single pages and renamed A.pdf through to Z.pdf using Batch rename in Bridge.

The next trick was getting the names to appear in the database as single letters and in such a fashion that the letters would appear in the correct places. This meant making a formula which would:

  • Know which letter was in a certain position (e.g. 3 letters in, at the end, etc);
  • Know if a letter had nothing in it and would remain blank;
  • Would add the letters .pdf at the end of the result so that the merge would know it was looking for a picture, rather than placing text.

So the following formula was made for all letters except for the last letter:


where X represents how many letters away from the right hand side that needs to be displayed in the cell, and A2 is the name which is to be split into individual letters.

The last letter had the following formula:


The excel file was saved just in case, but was also saved to a Tab Delimited Text file for InDesign.

The rest was easy. Pencil case clipart is to the back, plastic holders are to the front, and 11 graphic frames representing the letters are made. Once the data is called in from the Data Merge palette, the picture fields were put into the appropriate graphic frames so that, once preview was on, the letters would change and but effectively be right-aligned, and contain necessary blank squares.

Download the Pencil Case PDF (which contains the InDesign file, pictures and excel files as attachments).


This was harder than the pencil case letters but employed many of its techniques such as:

  • Requiring images to be made of the letters rather than using type-based letters
  • Using a similar excel spreadsheet to break the names into 11 separate PDFs, with the only exception being that if a field was blank, it was to reference a picture called BLANK.PDF

The easiest part was the background which was just clip-art. The letters were made in a similar fashion to the last post, except that the letters deliberately had some space to the left and right of the letter. This will become apparent soon why this was done.

The excel file was essentially the same except for the addition of the following letters at the end of the formulas:


The addition of this type returns the result “BLANK.PDF” anytime there is no letter to show. This will be important.

Next, a centered textbox is placed above the clipart. A rectangle the size of the scrabble letters is then drawn, cut, and then pasted into the centered textbox as inline text – eleven times. From here, the data is called in via the Data Merge palette and the fields are dragged into position, but BEFORE preview is checked, there is a very important option which has to be selected in the Content Placement Options, namely that in Image Placement (fitting) that the option “Fit Frames to Images” is selected.

It is also important that before hitting preview, that PDFs imported into the art use the Art measurement. To make sure that this happens, import any PDF with the “show import options” on. Once the import options dialog box appears, make sure that the art measurement is used. Click ok, but then delete the picture. This should ensure that all future PDFs placed into the art use the Art box as the defining measurement.

From here, if Preview is checked, the names should now appear centered. Without the “Fit Frames to Images” option being checked, the letters would appear off-centre because of the blank rectangles to the left.

The final trick so that the letters appear to be sunken into the board was to draw a rectangle (no stroke or fill) in the area where the letters should be in the rack, and then cut the centered letters and “Paste Into” the rectangle which was just drawn.

Download the Scrabble Letters PDF (which contains the InDesign file, pictures and excel files as attachments).

Square Pegs now fit into Round Holes

One hurdle I’ve often encountered with Data Merge is when text fields which have to fit in a given space. Examples may be speech bubbles, headlines or nametags.

Normally, the way to proceed with this variety of project would be to determine the longest word in the database and set the size of the font to fit the longest word. This is fine for large words, but tends to make small words look out of place.

Ideally, it would be nice for the type to fit according to the size of the name, but that isn’t possible… is it? Well, with GREP styles, it is.

This example features a name-badge which contains first names which range between 3 to 11 letters long. The first thing to do is determine how many letters will fit within the given space. To do this, use the widest letter of the font being used (M in this example) and type the letter 3 times until the type fits the box as desired. Now create this as a paragraph style (e.g. Badgetype).

From here, type an additional letter. There will be an overflow warning – this is intentional. From here, use Ctrl-A to select the type and make a new character style called mynameis4. Make sure that the “Apply Style to Selection” checkbox is ticked; and that the “Preview” checkbox is ticked. Within the character style, only edit the Advanced Character Formats and change the items in this panel to distort the type accordingly until the type comes back into view. Once the type comes back into view and appears as desired, click OK.

Now, type another letter and once again an overflow warning will appear. Again, use Ctrl-A to select the type and duplicate the character style to create a new character style called mynameis5. Again, go to the Advanced Character Formats and again distort the type until it appears as desired. Click OK.

Repeat this process until all 11 letters have character styles assigned to them. Apart from [None], there should be 8 character styles from mynameis4 to mynameis11. From here, select all the type again and select the character style [None] to remove the style. The type will overflow once again, but this edit the Badgetype Paragraph style.

From this dialog box, go to the GREP styles options and make a new GREP style. From here, select the mynameis4 Character style; and in the GREP search below, type:


(four fullstops)

make another GREP style and select the mynameis5 Character style; and in the GREP search below, type:


(five fullstops)

Repeat this process until all remaining styles have GREP styles associated with them. That is, a seven letter style will have seven fullstops in the GREP search. The only exception is “mynameis11” which will have a “+” after the last fullstop. Click OK once this is done – the GREP styles dialog portion of the dialog box should look like the screengrab below.

If this is done correctly, the type should change size whenever a letter is added so that the type becomes incrementally smaller as type is entered.

To make this work with variable data, simply select the database and then insert the textfield and apply the paragraph style Badgetype to it.

Voila! I have included the PDF used for this tutorial which contains attachments of the InDesign and database files so that people can see exactly how this was constructed.

There’s more than one way to cut and stack…

In the post Using Data Merge to Impose? I demonstrated a way of making a cut and stack imposition using Data Merge. Essentially, it meant performing a data merge with artwork which was prepared one-up with the appropriate numbers to one large PDF; breaking the PDF into single pages; and then re-merging into a layout which was 6up (or however many up as required). While it demonstrates that Data Merge CAN do this, it is quite complicated and probably a technique which is nice to know but unlikely to ever use.

Following from a post in the Adobe Forums with a frustrated poster unable to prepare a cut and stack Data Merge, another method has been revealed which does away with the need for a second merge and is a very clever use of the Multipage Importer script written by Scott Zanelli. This was discovered by Adobe Forums regular Peter Spier, who was happy to credit me with providing the route for the idea. See the full post here:

Just for the record, I am against using InDesign as imposition software, but for the sake of those that have to; or to simply demonstrate the power and usefulness of scripts, I hope this post provides some value.

Nevertheless, here is how it is done. This example assumes DLs 3-up on an A4 page much like the original post from the Adobe Forums, but for the sake of this example only uses 99 records. Before beginning, make sure that the multipageimporter.jsx script is installed – if it isn’t, it can be downloaded here.

1) Prepare the data and the merge one-up and merge the result to a PDF or InDesign file. In the actual files attached at the end of this story, i’ve made a PDF rather than a new InDesign file.

2) Make a new InDesign document and start the multipageimporter.jsx script.

3) Once the dialog box appears, put in the following:

4) Click OK. the script will run and place the first third of results in the top third of the sheet. Double-click the multipageimporter.jsx script and this time put in the following:

5) Click OK. the script will run and now place the next third of results in the second third of the sheet. Once again, double-click the multipageimporter.jsx and put in the following:

6) Click OK. The script will run and place the final third of results on the last third of the sheet.

The key to using this script to behave like a cut and stack imposer is the page-range entered into the script; and the offsets applied each time that the script is run. Because the DL panels are 99mm high, the offsets for the second script run will be offset by 99mm, and 99 +99 (198) for the last run.

Files demonstrating what i’ve done can be downloaded here.

%d bloggers like this: