Re: [xml-doc] XSL Booklet Printing
- At 2008-11-20 05:05 +0000, Jennifer Linton wrote:
>I know I can display the total page count of the deliverable usingRight ... because each processor will process hyphenation,
>page-number-citation-last, but that only works if I send the FO
>document through the FO processor to actually render that number into
justification, leading and other properties differently, the
resulting page count could be different with every processor. The
.fo file doesn't have page breaks or page counts, only the
abstractions that the FO engine replaces with actual page information
only after it determines what that information is by interpreting the
>Is there a way to get that physical number orSince the .fo tree only contains the abstractions of pointing to page
>count/label/mark/indicate each physical page to get the number in the
>.fo result tree to use that information for post processing the
>resulting .fo file copying the existing fo tree and inserting the
>blank page sequences as needed?
numbers after being processed, there is no way to inspect the .fo
tree for page breaks or for counting page numbers.
When shuffling pages for the various renditions of my XSL training
books, I also need to know how many blank pages to insert, and for
this I act on the resulting PDF file rather than the intermediate FO file.
I use the free iText library from sourceforge: http://itext.sf.net
It is a Java library, but I access it from Python using Jython:
Then I get the basics of what I need:
from com.lowagie.text.pdf import PdfReader
reader = PdfReader( "file.pdf" )
totalPages = reader.getNumberOfPages()
Of course there is a lot more to iText, but that gives the flavour.
XSL engines have intermediate formats that include processed XSL-FO
information with page break information and page counts as
well. These files are XML instances which means you can manipulate
those with XSLT and not have to consider other programming languages.
I went the Python route because I use different XSL-FO tools at
different times and there is no consistency with the internal formats
(after all, they are internal). Plus, I can now shuffle PDF pages
regardless of how they are produced, such as merging my XSL-FO output
with the PDF pages output from OpenOffice.
I hope this helps.
. . . . . . . . . . . . . . Ken
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
: Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman mailto:gkholman@...
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal