2020.2

Table Of Contents
l attachment 1: Section A, Section B
l attachment 2: "Part2", which is Section C. The file name of this attachment is the part
name.
Controlling multiple Email attachments
The following script attaches the following sections to an email:
l Print section 3 + 4 as attachment with continued page numbers
l Print section 6 as separate attachment
if (channel == Channel.EMAIL) { // only when generating Email
output
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section 1'].enabled = false;
merge.context.sections['Section 2'].enabled = false;
merge.context.sections['Section 3'].enabled = true;
merge.context.sections['Section 3'].part = "PDFAttach1";
merge.context.sections['Section 4'].enabled = true;
merge.context.sections['Section 4'].restartPageNumber = false;
merge.context.sections['Section 5'].enabled = false;
merge.context.sections['Section 6'].enabled = true;
merge.context.sections['Section 6'].part = "PDFAttach2";
}
}
Note
For another example, see this how-to: Output sections conditionally.
Control Script: Setting a Print section's background
In the Print context, an image file can be used as a Print section's background; see "Using a
PDF file or other image as background" on page140.
If you want the section background to be switched automatically, depending on the value of a
data field, you need a Control Script. There is a Script Wizard that can generate that script for
you, provided that certain conditions are met; see: "Dynamic Print section backgrounds" on
page355.
Otherwise, you will have to write the Control Script yourself. This topic explains how to write a
Page 425