XF Rendering Server supports the usage of fo:force-page-count extension.
Force-page-count is used to impose a constraint on the number of pages in a page-sequence. If this constraint is not satisfied, an additional page/pages will be added at the end of the sequence.
The following values are available:
• | auto |
Forces the last page in this page-sequence to be an odd-page if the initial-page-number of the next page-sequence is even.
Forces the last page in this page-sequence to be an even-page if the initial-page-number of the next page-sequence is odd.
If there is no next page-sequence or if the value of its initial-page-number is "auto", the attribute does not force any page.
• | even |
Forces an even number of pages in this page-sequence.
• | odd |
Forces an odd number of pages in this page-sequence.
• | end-on-even |
Forces the last page in this page-sequence to be an even-page.
• | end-on-odd |
Forces the last page in this page-sequence to be an odd-page.
• | no-force |
Does not force either an even or an odd number of pages in this page-sequence.
• | multiple-of(x) |
The behaviour is similar to force-page-count="odd". The number of pages in the sequence will be a multiple of the "x" integer set as value.
• | end-on-multiple-of(x) |
The behaviour is similar to force-page-count="end-on-odd". Forces the last page in this page-sequence to be a multiple of the "x" integer set as value.
Examples of usage:
1. force-page-count="even"
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="6in" page-height="3in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page">
<fo:flow flow-name="xsl-region-body">
<fo:block background="red">Page Sequence 1</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" force-page-count="even">
<fo:flow flow-name="xsl-region-body">
<fo:block background="green">Page Sequence 2</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
One more page will be added to the last page sequence in order for the respective sequence to have an even number of pages.
Output:
2. force-page-count="end-on-even"
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="6in" page-height="3in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page">
<fo:flow flow-name="xsl-region-body">
<fo:block background="red">Page Sequence 1</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" force-page-count="end-on-even">
<fo:flow flow-name="xsl-region-body">
<fo:block background="green">Page Sequence 2</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
No new page will be added for the second page sequence because the total count of pages is even.
Output:
3. force-page-count="multiple-of(x)"
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="6in" page-height="3in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page">
<fo:flow flow-name="xsl-region-body">
<fo:block background="red">Page Sequence 1</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" force-page-count="multiple-of(3)">
<fo:flow flow-name="xsl-region-body">
<fo:block background="green">Page Sequence 2</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Two more pages will be added to the last sequence because its page count must be a multiple of 3.
Output:
4. force-page-count="end-on-multiple-of(x)"
<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter Page" page-width="6in" page-height="3in">
<fo:region-body region-name="xsl-region-body" margin="0.700in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter Page">
<fo:flow flow-name="xsl-region-body">
<fo:block background="red">Page Sequence 1</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Letter Page" force-page-count="end-on-multiple-of(3)">
<fo:flow flow-name="xsl-region-body">
<fo:block background="green">Page Sequence 2</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Only one page will be added to the last pages sequence in order for the total number of pages to be a multiple of 3.
Output: