Reputation: 509
My XSL:
<fo:layout-master-set>
<fo:simple-page-master master-name="normal" page-height="210mm" page-width="148mm">
<fo:region-body region-name="xsl-region-body" margin="28mm 2mm 10mm 8mm" />
<fo:region-before region-name="xsl-region-before"/>
<fo:region-after region-name="xsl-region-after" extent="12mm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="blank" page-height="210mm" page-width="148mm">
<fo:region-body/>
<fo:region-before region-name="header-blank" extent="210mm"/>
<fo:region-after region-name="xsl-region-after" extent="12mm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference blank-or-not-blank="not-blank" master-reference="normal"/>
<fo:conditional-page-master-reference blank-or-not-blank="blank" master-reference="blank"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="document" force-page-count="end-on-even">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-weight="normal" font-family="Helvetica" text-align="center" margin="6mm 2mm 0mm 8mm">
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="9pt" font-weight="normal" font-family="Helvetica" margin="0mm 2mm 0mm 8mm">
P <fo:page-number/>/<fo:page-number-citation ref-id="TheVeryLastPage"/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="header-blank">
<fo:block text-align-last="center" font-size="9.5" margin-top="75mm">
Intentionally left blank
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block id="TheVeryLastPage"> </fo:block>
</fo:flow>
</fo:page-sequence>
Output: First page: P 1/1 Second page: P 2/1
Desired output: First page: P 1/2 Second page: P 2/2
How can I include the Intentionally left blank page in my page count?
Any help will be appreciated.
Upvotes: 1
Views: 873
Reputation: 7905
It can't work that way, because your block bearing the id TheVeryLastPage
does not appear in the last page that has been automatically generated. Correct numbering will be generated only if the additional blank page (intentionally left blank) does not need to be generated.
Apache FOP, which is sometimes and unfortunately buggy or limited regarding page number retrieval (in particular, if you use <fo:page-number-citation-last ref-id="">
that might help in your case, for example by setting the id on the <fo:block>
that is use to display the page numbering, it should work properly - and it actually does with a commercial renderer such as Antenna House because it is able to perform a 2-pass generation process).
The only way to this is with FOP as follows:
<fo:page-sequence>
<fo:page-number-citation-last>
Your modified code will look like this:
<fo:page-sequence master-reference="document" force-page-count="end-on-even" id="TheVeryLastPage">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-weight="normal" font-family="Helvetica" text-align="center" margin="6mm 2mm 0mm 8mm">
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="9pt" font-weight="normal" font-family="Helvetica" margin="0mm 2mm 0mm 8mm">
P <fo:page-number/>/<fo:page-number-citation-last ref-id="TheVeryLastPage" />
</fo:block>
</fo:static-content>
<fo:static-content flow-name="header-blank">
<fo:block text-align-last="center" font-size="9.5" margin-top="75mm">
Intentionally left blank
<!--fo:block id="TheVeryLastPage" /-->
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>Thy hand, belinda, darkness shades me.</fo:block>
<fo:block>On thy bosom let me rest.</fo:block>
<fo:block>More I would, but death invades me.</fo:block>
<fo:block>Death is now a welcome guest.</fo:block>
<fo:block>When I am laid in earth, may my wrongs create</fo:block>
<fo:block>No trouble in thy breast.</fo:block>
<fo:block>Remember me, but ah! forget my fate.</fo:block>
</fo:flow>
</fo:page-sequence>
Upvotes: 2