Dynamic section backgrounds

Avatar
Dynamic section backgrounds

Dynamic section backgrounds

Creating document variants based on data and a collection of pre-produced designs is a typical variable data printing scenario. These could be brochures with information of a reseller/dealership, postcards with an audience specific design from a library or personalised letters with recipient and sender information.

In OL Connect Designer switching these designs is commonly achieved by writing a control script to dynamically set the background image of a section. Version 2019.2 introduced a new scripting wizard to create such documents in a breeze and without having to write any code.

This article explains how to use the Dynamic Section Background wizard to create postcard variants based on a collection of images and a matching data file. The data file contains information about the recipients and their favorite travel destination.

Walkthrough

The design files

The postcard designs are created in Adobe Illustrator and stored as PDF in a folder on disk.

Postcard designs can be stored as PDF in a folder for example.

Each design consists of two pages: the front and back of the postcard. The image below shows the japan.pdf card opened in Acrobat Reader (Two Page View).

An example of a postcard image design.

The sample data

The value of the destination data field in the data holds the basename of the design files (e.g. japan, india, egypt and australia). This information will be used to construct the dynamic path. A sample data record looks something like this:

<record> 
    <first>Mano</first> 
    <last>Gutierrez</last> 
    <country>United States</country> 
    <street>74 Chinook Hill</street> 
    <city>Washington</city> 
    <postal>20319</postal> 
    <state>DC</state> 
    <address>Mano Gutierrez&lt;br&gt;74 Chinook Hill&lt;br&gt;Washington, DC 20319</address> 
    <destination>japan</destination> 
</record> 

Create a new Connect template

You can create a new template right from the File system.

  1. Download and extract the sample designs: travel designs.zip.
  2. Right click one of the design files and choose Enhance with Connect from the contextual menu. The New PDF-based Print Template wizard appears. The Path field holds the full path to the selected image file.
  3. Uncheck the Save with template option. By default the selected image is added to the Images folder of the template and used from that location. In this example we want to use the images from the folder on disk.
  4. Click Finish. A new document is created showing two pages. The selected image is set as background for the initial section. When using a multi-page PDF as section background a page for each page in the PDF is automatically added to the document.

Note! The Enhance with Connect option reads the page size of the selected PDF and creates a new template using these dimensions.

Note! When producing the final output via OL Connect Workflow running on a different machine one has to make sure that the specified folder is accessible by that machine. Alternatively one could add all image variants to the Resources folder of the template and set one entry to the background of the print section manually.

Load the sample data

  1. Download and extract the sample DataMapper configuration: travel datamapper.zip
  2. Open the travel.OL-datamapper and toggle back to the template editor.
  3. The Data Model panel shows the data fields and the values of the first record.

Setup the dynamic background

  1. Right click the print section (Section 1) in the Contexts folder of the Resource panel. Choose Dynamic Background. The Dynamic Background wizard appears. Several options of the wizard are automatically set based on the image we selected to create the document.
    1. The Location is set to Folder on disk.
    2. The Path field points to the folder holding our image.
    3. The Suffix for the first field row is to .pdf. These options define the basis for the dynamic image path. All what is left is selecting the data field holding the basename of the images.
  2. Select destination in the Field-dropdown of the first field row.
  3. Click OK. A new script entry is added to the Control section of the Scripts panel. Control scripts run before standard personalisation scripts.
Dynamic Background wizard view

Toggle to the Preview mode and browse through the records to see the various images being applied to the section background.

Preview mode

Tagged in: Backgrounds



Leave a Reply

Your email address will not be published. Required fields are marked *