Using ApacheFop 2.2 I get a multi-page document. The document consists of parts, each of which begins with the page number 1. After the formation of PDF there is a need to print the 5th page of the document. When specifying a page for printing, the 11th page of the document will be printed (it is the 5th page in its part). How to generate PDF correctly, so that the 5th page was exactly the 5 th page of the document, and not part of it?
fo:
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" font-size="30pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="page">
<fo:region-body region-name="body" margin-top="22mm" margin-bottom="34mm"/>
<fo:region-after region-name="footer" extent="31mm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="blank-page">
<fo:region-body region-name="body-blank" margin-top="22mm" margin-bottom="34mm"/>
<fo:region-after region-name="footer" extent="31mm"/>
</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="page"/>
<fo:conditional-page-master-reference blank-or-not-blank="blank" odd-or-even="even" master-reference="blank-page"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="document" initial-page-number="1" force-page-count="end-on-even">
<fo:static-content flow-name="footer">
<fo:block>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="body">
<fo:block break-after="page">Text1</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="document" initial-page-number="1" force-page-count="end-on-even">
<fo:static-content flow-name="footer">
<fo:block>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="body">
<fo:block break-after="page">Text3</fo:block>
<fo:block break-after="page">Text4</fo:block>
<fo:block break-after="page">Text5</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="document" initial-page-number="1" force-page-count="end-on-even">
<fo:static-content flow-name="footer">
<fo:block>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="body">
<fo:block break-after="page">Text7</fo:block>
<fo:block break-after="page">Text8</fo:block>
<fo:block break-after="page">Text9</fo:block>
<fo:block break-after="page">Text10</fo:block>
<fo:block break-after="page">Text11</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
In this case, a page number is not the best way to tell a user which page to print, because it's going to be confusing anyway. You might have more than one page with page number 5 in your document, for example. Alternatives: