Dynamic Print section backgrounds
Print sections can have a PDF background image (see Using a PDF file or other image as background). This feature is often used to create a Print template from a PDF file while making some minimal changes to it. Of course, the PDF file itself can't be edited in a Designer template, but when it is used as a section's background, text and other elements, such as a barcode, can be laid on top of it.
Dynamic backgrounds are switched automatically depending on the value of a data field.
Adding a dynamic background
Dynamic background PDFs can be added to a Print section using the Dynamic Section Background Script Wizard if:
-
One or more data fields contain values on the basis of which the PDFs can be switched.
-
There is an appropriate PDF for each case. It is important that the PDFs are named after the various possible values of the related data field.
-
All PDFs are stored in one folder (the Images folder on the Resources pane, or an external folder).
Otherwise, adding a dynamic background requires a self-made script (for help on this, see Control Script: Setting a Print section's background).
To use the Dynamic Section Background Script Wizard:
-
Open the Wizard. There are three ways to do that:
-
Right-click the Print section on the Resources pane and click Dynamic Background.
-
On the Scripts pane, click the arrow next to the New button and select Dynamic Background Script. Double-click the script to open it.
-
On the Scripts pane, right-click Control and select New > Dynamic Background Script.
-
-
Select the desired section from the Section drop-down. You may also change the name of the script.
-
Select the location of the files:
-
Select Resources if the PDFs reside in the Images folder on the Resources pane.
-
Folder on disk refers to a folder on a hard drive that is accessible from your computer. Click the Browse button to select a folder.
As an alternative it is possible to enter the path manually. You can give a local path (e.g. C:\Images\) or use the "file" protocol. The complete syntax of a fully qualified URL with the "file" protocol is:file://<host>/<path>
. Note: if the host is "localhost", it can be omitted, resulting infile:///<path>
, for example:file:///c:/resources/images/
. -
Online requires you to give a specific web address (for example, http://www.mysite.com/images/).
-
-
The Dynamic Section Background Script Wizard composes the file names (including the path) based on the selected location, the prefix, the value of a data field, and the suffix. The variable part of the file names is the value of the data field(s) in the Field column. The prefix and suffix are meant to contain static parts of the file names.
Click the first field in the column Field, and then click the downward pointing arrow. Select the data field to be evaluated.
If you want the file name to be composed of the value of several data fields, simply click in the next row or click the Add button. This adds a row. Note that the rows will be concatenated to compose one file name. Only the last suffix should contain the file extension (.pdf). -
Click Apply or OK.
The script assigns the resulting file name, including the path and file extension, to the URL of the section's background. -
Now click the Preview tab and browse through the records to verify that the script works as expected.
If you want to see the underlying script, reopen the script and click the Expand button. For more information on this type of script, see Control Script: Setting a Print section's background).
Note: Any non-content features in the original PDF will get stripped out of the original PDF. These include document navigation (outline), local links, hyperlinks, annotations (markup annotations, comments, etc.), digital signatures, multimedia features, interactive forms, and tagged PDF features (marks in the page content will stay, but the logical structure is gone).