Student Pack is a pack of enrolment and course documents, sent to a student after they enroll for a semester.
The example uses a Coordinator template to bring together multiple separate templates into a single PDF file.
The Coordinator template pre-processes data and uses logic to determine which templates are included in the finished document..
This example in detail
Using a Coordinator template
A Coordinator template is distinguished from normal templates by the <<coordinator:>> directive.
The directive <<ref:templateName.docx>> is used to refer to each template.
In this example, the Coordinator template, StudentPackCOORD.docx references CoverPageTemplate.docx, WelcomeLetterTemplate.docx, CodeofConductTemplate.docx, OrientationFlyerTemplate.docx, StudentStatementTemplate.docx, CourseDetailsTemplate.docx to generate a student pack.
Preprocessing data
A coordinator template can be used to pre-format the data.
The formatted values are assigned to variables which are accessible to all the referenced templates.
Using logic in a Coordinator template
Conditional and repeating logic can be used within Coordinator templates.
In this example, the templates CodeOfConductTemplate.docx and OrientationFlyerTemplate.docx are included in the final output only when the conditional section <<cs_newStudent>> evaluates to true.
Generating either a single PDF file or a ZIP file
This Coordinator example is designed to output a single PDF or a Zip file comprising of two PDF files.
The output format is based on the value of the boolean data field keepCourseInfoSeparate.
When keepCourseInfoSeparate is true, <<coordinator:newFile:CoursesBooklet>> command is executed creating Zip file containing
- StudentPackCOORD.pdf with all the templates referred above the command and
- CourseBooklet.pdf with all the templates referred below the command.
Otherwise a single PDF named StudentPackCOORD.pdf is generated from all the referred templates.