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 Nwilan Glirt <nw...@hotmail.com> on 2002/11/11 16:17:19 UTC

page-position=last vs. conditional blocks

Now that I discovered that page-position="last" is not implemented in FOP, I 
am looking for alternative ways to produce "first", "middle" and "last" 
specific pages. Is there any way to do some conditional stuff on blocks such 
as testing if we are currently writing the last page?





_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


Re: page-position=last vs. conditional blocks

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Nwilan Glirt wrote:
> Now that I discovered that page-position="last" is not implemented in 
> FOP, I am looking for alternative ways to produce "first", "middle" and 
> "last" specific pages. Is there any way to do some conditional stuff on 
> blocks such as testing if we are currently writing the last page?

Askinig for page-position="last" seems to be thequestion of
the week.
If creation time is uncritical, a two pass solution can provide
this. The generated FO uses a repeatable--page-master-reference
or a repeatable-page-master-alternatives for the main document body,
in the first pass the maximum-repeats is unbounded (very large),
in the second pass it is restricted to the relevant page count so
that the next page master can kick in for the last page.
In the XSLT, declare a parameter for the page count and something
like this:
   <xsl:param name="page-count"/>
   <xsl:template name="generate-page-master">
     <fo:page-sequence-master master-name="all">
       <!-- page master for first page -->
       <fo:single-page-master-reference master-reference="first"/>
       <!-- page master for rest -->
       <fo:repeatable--page-master-reference master-reference="rest"
         maximum-repeats="{$page-count}"/>
       <!-- page master for last, unused in first pass (no harm) -->
       <fo:repeatable--page-master-reference master-reference="last"/>
     </fo:page-sequence-master>
   </xsl:template>
There has been sample Java code published on this list for automating
the whole process:
   http://marc.theaimsgroup.com/?l=fop-user&m=102002702026609&w=2

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-position=last, FOP vs XEP, business forms

Posted by Jeremias Maerki <de...@greenmail.ch>.
Of course. This approach has been proposed a number of times, but that
only works if you really know the height of each invoice position in
advance. But at least for me, it's not that "general" solution I'm
looking for. Let's hope this helps at least Nwilan Glirt.

On Mon, 11 Nov 2002 15:49:00 +0000 Ward, Christopher wrote:
> Would it be posible to iterate over your list of invoices (by using
> recursion with the head and tail approach in the xslt translation). But keep
> a counter of the number of invoices processed this page. When the counter
> hits a certain level start a new page by doing the carried forward/brought
> forward part of the page break. 
> 
> That way if there are no page breaks all of the invoice lines will appear on
> the one page, and if there are more invoice lines that can appear on a
> single page the appropriate page break will appear.
> 
> This approach will however mean that you have a page sequence for each page.
> It will also mean that you have to know how many invoice lines can appear on
> a single page.

Jeremias Maerki


Re: page-position=last vs. conditional blocks

Posted by Jeremias Maerki <de...@greenmail.ch>.
If you know what's exactly on your last page (ex. the last page is a
form that the recipient of the document has to fill out) you could try
to use two page-sequences, where the second page-sequence only defines a
single page-master for the last page. But that won't work if content
flows from the n-1th page to the last page.

Anyway, during XSLT you don't get any information from FOP (even if it
had it) to determine the last page. You can do that only if in the way
outlined above. Perhaps, you have a situation like that.

I hope this helps anyway.

On Mon, 11 Nov 2002 16:17:19 +0100 Nwilan Glirt wrote:
> Now that I discovered that page-position="last" is not implemented in FOP, I 
> am looking for alternative ways to produce "first", "middle" and "last" 
> specific pages. Is there any way to do some conditional stuff on blocks such 
> as testing if we are currently writing the last page?


Jeremias Maerki


Re: page-position=last vs. conditional blocks

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Nwilan Glirt wrote:

> Now that I discovered that page-position="last" is not implemented in
> FOP, I am looking for alternative ways to produce "first", "middle" and
> "last" specific pages. Is there any way to do some conditional stuff on
> blocks such as testing if we are currently writing the last page?

No, even FOP itself is unable to know if it's the last page - that's the core 
problem. Actually it probably requires lookahead, the only way I can imagine 
is to try to layout *every* page as last and if flow is not exhausted, 
relayout it again as not last, anyway it's a topic for fop-dev.
If you know explicitly what objects would be on the last page and you are sure 
it fits exactly 1 page you can move last page objects into a different 
fo:page-sequence object with appropriate master-reference to the last page master.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel