You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Subbiah <su...@utdallas.edu> on 2004/08/01 04:36:16 UTC

Page Numbers

I know how to get page numbers <fo:page-numbers/>

How to get pagenumbers in the format 
"Page 1 of 3"

regards,
raman


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Page Numbers

Posted by Subbiah <su...@utdallas.edu>.
Thxs 


regards,
raman
-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: Sunday, August 01, 2004 7:17 AM
To: fop-user@xml.apache.org
Subject: Re: Page Numbers

Subbiah wrote:
> How to get pagenumbers in the format
> "Page 1 of 3"

FAQ:
  http://xml.apache.org/fop/fo.html#fo-total-pages

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Page Numbers

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Subbiah wrote:
> How to get pagenumbers in the format 
> "Page 1 of 3"

FAQ:
  http://xml.apache.org/fop/fo.html#fo-total-pages

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Page Numbers

Posted by "Ganesh Babu Nallamothu, Integra-India" <ga...@integra-india.com>.
Dear Raman,

Adding the total page count (so we can have 'Page 3 of 5') is a two step
process, based on the use of the 'id' attribute which uniquely identifies an
XML element.

We put a block on the last page with the id of 'last-page', and then we use
the page-number-citation element to get the number of that page as our total
number of pages. Typically the block with the id of 'last-page' is empty so
we can move it if required without disturbing the document text.

The XML for the last block in the document looks like this:

<fo:block id='last-page'/>

And the XML to retrieve the last page number and put it in the footer looks
like this:

<fo:page-number-citation ref-id='last-page'/>

You can see how the id and ref-id values match. This is how XSL-FO
associates the two elements and knows which block to retrieve the page
number from.

Find attached sample coding for to get the total page number.

<?xml version='1.0' encoding='UTF-8'?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <fo:layout-master-set>
      <fo:simple-page-master master-name="simple" margin='2.5cm'>
         <fo:region-body margin="2.5cm" margin-bottom='1cm'
region-name="body" background-color='#eeeeee'/>
         <fo:region-after extent='1cm' region-name="footer"
background-color='#dddddd'/>
         <fo:region-start extent='2.5cm'/>
         <fo:region-end extent='2.5cm'/>
      </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="simple">
      <fo:static-content flow-name="footer">
          <fo:block text-align='center'>
          Page <fo:page-number/>
          of <fo:page-number-citation ref-id='last-page'/>
          </fo:block>
      </fo:static-content>
      <fo:flow flow-name="body">
         <fo:block>Hello World</fo:block>
         <fo:block id='last-page'/>
      </fo:flow>
   </fo:page-sequence>
</fo:root>


Regards,
Srinivasan

-----Original Message-----
From: Subbiah [mailto:subbiah@utdallas.edu]
Sent: Sunday, August 01, 2004 8:06 AM
To: fop-user@xml.apache.org
Subject: Page Numbers


I know how to get page numbers <fo:page-numbers/>

How to get pagenumbers in the format
"Page 1 of 3"

regards,
raman


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org