Sunday, March 18, 2012

How to Make an InDesign Text Frame with a Background Image

This has been on my InDesign wish-list for quite a while. And at first glance, you might assume that it is possible to make a text frame with a patterned background or background image. Because:
  • You can make patterns in InDesign.
  • You can make text frames with a colored background.
  • You can make a text frame with a gradient background.
But as much as I try, there is no way to apply a background image to an InDesign text frame. I got to thinking about the components that make up this idea:
  1. The background image
  2. The text frame
So how could I construct an object where these two items stick together and act as one unit? I want them to not only move together, but be easy to edit and resize dynamically. For example, if the text frame resizes, the background graphic frame will resize accordingly. To accomplish this, I tried a few different options.

The first attempt consisted of a background image anchored in a text frame.
Pros: In the anchored object settings for the background pattern, if you check "Prevent Manual Positioning" you can easily move the text and the background together you would expect to be able to.

Cons: Anchored objects always appear in front of the text frame in which they are anchored. This means that the background image sits on top of the text, obscuring it. Plus, once "Prevent Manual Positioning" is set, the background pattern frame (which is an anchored object) is next to impossible to select and edit.

My second attempt consisted of a text frame anchored into the path text of the background image.

Pros: This achieves the visual effect that I want.
Cons: The two objects don't really move together well as a single unit. The only way to get the two objects to "stick together" is by setting the anchored objects settings of the text frame to Above Line. Plus, since the text frame is anchored inside the path text of the graphic frame, InDesign makes it really difficult for you to move the text frame and patterned background by dragging. You can try all day long to move the two objects by clicking and dragging on the text frame, but all you can do is move the text frame up. Even though the text frame and the patterned background are stuck together, in order to move them, you must click and drag on the background graphic frame, not on the text frame.

My Solution:
After a couple of years of thinking, I finally figured out a workable solution: MagnetoGuides by Rorohiko. According to the Rorohiko website, "MagnetoGuides allows you to ‘magnetize’ one or more guides. Magnetized guides are special: they push or pull any ‘snapped’ items along when they are moved. If a page item is ‘snapped to’ a magnetic guide at only one side, then the page item simply moves along when the guide is moved.  If a page item is ‘snapped to’ more than one magnetic guide, then the page item will stretch or shrink as needed so it can stay ‘snapped’ to all magnetic guides.  This allows you to reposition and resize multiple page items concurrently without having to group them."

So here's how we can use this to create a background image for a text frame:

1. Create a background image.
2. Create a text frame.
3. Align both objects horizontally and vertically.
4. API > MagnetoGuides > Add Guides to Object (this adds eight guides: 4 horizontal and 4 vertical)

5. Now select the top two horizontal guides.
6. API > MagnetoGuides > Link Guides
7. Next, select the bottom two horizontal guides and link them.
8. Repeat the guide-linking process for the both vertical sets of guides.
9. Now, move any one of those guides and see what happens.

Pros: Because the text frame and the background image are each touching the special Magento Guides, both frames resize dynamically when the guides are moved. And because this solution does not involve anchored objects, You can have either object on top, however you want stack them. Another great thing about not using anchored objects is that you can easily select and move the frames.
Cons: None.

Now, the background pattern that I used for this example was created using TeaCup PatternMaker. Once I moved one of the MagnetoGuides, the background frame resized dynamically and squished the pattern.

Before Pattern Reset (See how the pattern is squished?)

But fortunately, PatternMaker has a nifty little button called "Reset Pattern." Basically, it puts the pattern back to the way it was before you changed the frame size.

After Pattern Reset

This article demonstrates just a tiny bit of the capability of the Magento Guides plugin. For more ideas on how to use this plugin, visit the MagnetoGuides page, scroll all the way to the bottom and watch the demo video. There's also a 27 page user guide that comes with the plugin.