java - Adding Index Page in PDF created with Apache FOP -


this question has answer here:

i have written application using apache fop, generates pdfs many multiple chapters. there way, know - chapter appears on page. actually, need create index in beginning, tells chapter appears on page.

you can put id on element need know page number of, , reference <fo:page-number-citation ref-id="id"/>.

example:

  1. put id automatically generated id on each block contains title of chapter:

    <xsl:for-each select="chapter">     <fo:block id="{generate-id(.)}">         <xsl:value-of select="@title"/>     </fo:block> </xsl:for-each> 
  2. then, reference id gave block when looping on same input elements @ start index is:

    <xsl:for-each select="chapter">     <fo:block id="{generate-id(.)}">         <fo:page-number-citation ref-id="{generate-id(.)}"/>     </fo:block> </xsl:for-each> 

it doesn't matter whether index (which more table of contents here) generated before actual content or not, ids calculated xsl parser, , fop resolves these references after page layout (and page numbers) has been determined.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -