Simplex sections, duplex document

Hi,

my template has multiple sections with dynamic page count. I want to join all sections one after other without blank pages between so I set all sections as simplex. Requirement is to print entire document as duplex job, so I need to insert blank page at the end if generated page count from all section is odd. How?

Output should be in PDF, and we use PReS Connect Designer 2020.2

Thanks.

Hi Darkovuj,

The easiest way will be to add a extra Section to your list of Print Context Sections and disable the Section when the total page count is a odd value. You can do this by making use of the following Post Pagination Script:

Name: Example
Selector: body
Script:

var pageCount = merge.pagination.pageCount;

if ((pageCount % 2) == 0) {
	merge.context.sections["Extra Page"].enabled = false;
}

Note: It will be a good idea to assign no Master Page to the new created Print Context Section to make sure that it doesn’t have any content.

Do you have to run paginate() after this to make it work?

Please note that it is not possible to disable or enable a Print Context Section from within a Post Pagination Script by making of the JavaScript code which I have shared by my previous comment. Please use of a Control Script to disable or enable a Print Context Section instead.