2021.2

Table Of Contents
l Print section 3 + 4 as attachment with continued page numbers
l Print section 6 as separate attachment (also see "Parts: splitting and renaming email
attachments" on page919)
l Web sections A and B 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";
} else if (merge.context.type == ContextType.WEB) {
merge.context.sections['default Section'].enabled = false; //
disable whatever is the default section
merge.context.sections['Section A'].enabled = true;
merge.context.sections['Section A'].part = "WebPartA";
merge.context.sections['Section B'].enabled = true;
merge.context.sections['Section B'].part = "WebPartB";
}
}
Note
For another example, see this how-to: Output sections conditionally.
Note
If the Email PDF Password Script Wizard defines a password, and a template has a
Control Script that creates multiple PDF attachments, all the attachments are secured by
the same password by default. Using a Control Script, you can set set different
passwords for attachments; see "Control Script: Securing PDF attachments" on
page927.
Page 1461