Re: [xsl] Page numbering

Subject: Re: [xsl] Page numbering
From: "Eliot Kimber" <ekimber@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 25 May 2007 10:21:37 -0400
Eike Jordan wrote:

AFAIK it is not possible to calculate the number of pages without generating
the complete PDF. But perhaps iText [1][2] might be useful for your purposes.

Depending on your FO implementation you may not need to generate the PDF but you will have to process the FOs involved.


With Antenna House XSL Formatter, using it's Java or .NET API, you can process FO input and get back the number of pages produced, without also generating any actual output. This makes it possible to do what you might call "one and a half pass" processes when you need to know the page count for things. You can integrate this with your XSLT by writing an XSLT extension function (e.g., write a Saxon extension that uses the XSL Formatter Java API).

I believe RenderX XEP has similar capabilities but I've not tried to do it with XEP.

As mentioned, worst case is you generate PDF and use a tool like iText or PDFBox or another PDF library to get the page count and then do a second pass.

Cheers,

Eliot
--
W. Eliot Kimber
Professional Services
Innodata Isogen
8500 N. Mopac, Suite 402
Austin, TX 78759
(214) 954-5198

ekimber@xxxxxxxxxxxxxxxxxxx
www.innodata-isogen.com

Current Thread