Number pages for multiple merged FO documents

Top Previous Topic Next Topic  Print this topic

This section provides information on how to number pages based on the number of pages in the generated PDF vs. the number of pages in each FO document being merged in.

 

In order to use the total number of pages, the user have to build a DAL (Document Assembly Line) job that will reference all the individual FOs.

In each FO to be merged the following syntax must be included in one of the static contents:

 

 

       Page <fo:page-number/> of <fo:page-number-citation ref-id="xf#theEnd"/>

 

 

 

In the example below two FOs will be used to create a PDF. The syntax above will be included in the header of each FO document.

 

The first FO named "FirstFO.fo" is the following:

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<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:xfd="http://www.ecrion.com/xfd/1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="Letter Page" page-width="8.500in" page-height="11.000in">

                       <fo:region-body region-name="xsl-region-body" margin="0.700in"/>

                       <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.700in"/>

                       <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.700in"/>

                       <fo:region-start region-name="xsl-region-start" extent="0.700in"/>

                       <fo:region-end region-name="xsl-region-end" extent="0.700in"/>

               </fo:simple-page-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="Letter Page">

               <fo:static-content flow-name="xsl-region-before" font-size="12pt" font-family="Times">

                       <fo:block text-align="right" font-size="18pt">

                               Page <fo:page-number/> of <fo:page-number-citation ref-id="xf#theEnd"/>

                       </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-after" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-start" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-end" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:flow flow-name="xsl-region-body" font-family="Times" font-size="18pt">

                       <fo:block font-weight="bold" background-color="rgb(255,255,153)">

                               First FO document.

                       </fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

The second FO named "SecondFO.fo" is the following:

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<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:xfd="http://www.ecrion.com/xfd/1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="Letter Page" page-width="8.500in" page-height="11.000in">

                       <fo:region-body region-name="xsl-region-body" margin="0.700in"/>

                       <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.700in"/>

                       <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.700in"/>

                       <fo:region-start region-name="xsl-region-start" extent="0.700in"/>

                       <fo:region-end region-name="xsl-region-end" extent="0.700in"/>

               </fo:simple-page-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="Letter Page">

               <fo:static-content flow-name="xsl-region-before" font-size="12pt" font-family="Times">

                       <fo:block text-align="right" font-size="18pt">

                               Page <fo:page-number/> of <fo:page-number-citation ref-id="xf#theEnd"/>

                       </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-after" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-start" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-end" font-size="12pt" font-family="Times">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:flow flow-name="xsl-region-body" font-family="Times" font-size="18pt">

                       <fo:block font-weight="bold" background-color="rgb(255,255,153)">

                               Second FO document.

                       </fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

The DAL job will reference both of the individual FOs:

 

 

<?xml version="1.0" encoding="utf-8"?>

<xfj:job xmlns:xfj="http://www.ecrion.com/xfj/1.0">

       <xfj:output mime-type="application/pdf"/>

       <xfj:document id="doc1">

               <xfj:external-content src="FirstFO.fo"/>

       </xfj:document>

       <xfj:document id="doc2">

               <xfj:external-content src="SecondFO.fo"/>

       </xfj:document>        

</xfj:job>

 

 

 

Output:

 

NumberPages