Loading ...
Sorry, an error occurred while loading the content.

Re: [xml-doc] XSL Booklet Printing

Expand Messages
  • G. Ken Holman
    ... Right ... because each processor will process hyphenation, justification, leading and other properties differently, the resulting page count could be
    Message 1 of 2 , Nov 28, 2008
    • 0 Attachment
      At 2008-11-20 05:05 +0000, Jennifer Linton wrote:
      >I know I can display the total page count of the deliverable using
      >page-number-citation-last, but that only works if I send the FO
      >document through the FO processor to actually render that number into
      >the output.

      Right ... because each processor will process hyphenation,
      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
      XSL-FO content.

      >Is there a way to get that physical number or
      >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?

      Since the .fo tree only contains the abstractions of pointing to page
      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:
      http://www.jython.org

      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
    Your message has been successfully submitted and would be delivered to recipients shortly.