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 Adam Kovacs <a....@i-docs.com> on 2010/07/16 15:09:15 UTC
Fixed second page in output
Hi There!
I'm currently working on an XSL for a PDF which has a fixed second page.
The structure is the following:
First page: - Special header and start of table (table goes over more pages)
Second page: - Static content (an image for example)
Rest: - The rest of the table.
My problem is that the table always goes also into the second page, or on every odd page only.
I used:
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="first"/>
<fo:conditional-page-master-reference page-position="rest" master-reference="rest"/>
<!--fo:conditional-page-master-reference odd-or-even="even" master-reference="odd"/>
<fo:conditional-page-master-reference odd-or-even="odd" master-reference="even--"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
but I only need a special handling on the SECOND page...
Anybody had the same problem, or any idea that could help?
I also tried to use a master-reference to another page-sequence-master with again first and rest but this resulted in NPE:
java.lang.NullPointerException
at org.xml.sax.helpers.LocatorImpl.<init>(LocatorImpl.java:79)
at org.apache.fop.fo.pagination.PageProductionException.setLocator(PageProductionException.java:56)
Shouldn't this work?
Any help is really welcome!
Adam
Using Fop Trunk
Re: Fixed second page in output
Posted by Adam Kovacs <a....@i-docs.com>.
Dear Pascal!
thank you so very much!!!
Thats exactly what I was looking for!
(funny I have never worked with single-page-master-reference :) )
My solution is:
<fo:page-sequence-master master-name="document">
<fo:single-page-master-reference master-reference="first"/>
<fo:single-page-master-reference master-reference="second"/>
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
<fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
Thanks and greetings!
Adam
On 19.07.2010, at 10:25, Pascal Sancho wrote:
> Hi Adam,
>
> the solution can follow the 2 steps:
> 1- In your 2nd page master, the fo:flow should be to small to contain anything and make the content to shift to 3rd page
> 2- your fo:page-sequence-master should content something like that:
> <fo:single-page-master-reference master-name="page1"/>
> <fo:single-page-master-reference master-name="page2"/>
> <!-- and, for the rest: -->
> <fo:repeatable-page-master-reference/> <!-- or -->
> <fo:repeatable-page-master-alternative/>
>
> Pascal
>
> Le 16/07/2010 15:09, Adam Kovacs a écrit :
>
>> Hi There!
>>
>> I'm currently working on an XSL for a PDF which has a fixed second page.
>> The structure is the following:
>>
>> First page: - Special header and start of table (table goes over more pages)
>> Second page: - Static content (an image for example)
>> Rest: - The rest of the table.
>>
>> My problem is that the table always goes also into the second page, or on every odd page only.
>>
>> I used:
>>
>> <fo:page-sequence-master master-name="document">
>> <fo:repeatable-page-master-alternatives>
>> <fo:conditional-page-master-reference page-position="first" master-reference="first"/>
>> <fo:conditional-page-master-reference page-position="rest" master-reference="rest"/>
>> <!--fo:conditional-page-master-reference
>> odd-or-even="even" master-reference="odd"/>
>>
>> <fo:conditional-page-master-reference odd-or-even="odd"
>> master-reference="even--"/>
>> </fo:repeatable-page-master-alternatives>
>> </fo:page-sequence-master>
>>
>> but I only need a special handling on the SECOND page...
>>
>> Anybody had the same problem, or any idea that could help?
>>
>> I also tried to use a master-reference to another page-sequence-master with again first and rest but this resulted in NPE:
>> java.lang.NullPointerException
>> at org.xml.sax.helpers.LocatorImpl.<init>(LocatorImpl.java:79)
>> at org.apache.fop.fo.pagination.PageProductionException.setLocator(PageProductionException.java:56)
>>
>> Shouldn't this work?
>>
>> Any help is really welcome!
>>
>> Adam
>> Using Fop Trunk
>
Re: Fixed second page in output
Posted by Pascal Sancho <pa...@takoma.fr>.
Hi Adam,
the solution can follow the 2 steps:
1- In your 2nd page master, the fo:flow should be to small to contain
anything and make the content to shift to 3rd page
2- your fo:page-sequence-master should content something like that:
<fo:single-page-master-reference master-name="page1"/>
<fo:single-page-master-reference master-name="page2"/>
<!-- and, for the rest: -->
<fo:repeatable-page-master-reference/> <!-- or -->
<fo:repeatable-page-master-alternative/>
Pascal
Le 16/07/2010 15:09, Adam Kovacs a écrit :
> Hi There!
>
> I'm currently working on an XSL for a PDF which has a fixed second page.
> The structure is the following:
>
> First page: - Special header and start of table (table goes over more
> pages)
> Second page: - Static content (an image for example)
> Rest: - The rest of the table.
>
> My problem is that the table always goes also into the second page, or
> on every odd page only.
>
> I used:
>
> <fo:page-sequence-master master-name="document">
> <fo:repeatable-page-master-alternatives>
> <fo:conditional-page-master-reference page-position="first"
> master-reference="first"/>
> <fo:conditional-page-master-reference page-position="rest"
> master-reference="rest"/>
> <!--fo:conditional-page-master-reference odd-or-even="even"
> master-reference="odd"/>
> <fo:conditional-page-master-reference odd-or-even="odd"
> master-reference="even--"/>
> </fo:repeatable-page-master-alternatives>
> </fo:page-sequence-master>
>
> but I only need a special handling on the SECOND page...
>
> Anybody had the same problem, or any idea that could help?
>
> I also tried to use a master-reference to another page-sequence-master
> with again first and rest but this resulted in NPE:
> java.lang.NullPointerException
> at org.xml.sax.helpers.LocatorImpl.<init>(LocatorImpl.java:79)
> at
> org.apache.fop.fo.pagination.PageProductionException.setLocator(PageProductionException.java:56)
>
> Shouldn't this work?
>
> Any help is really welcome!
>
> *Adam *
> *Using Fop Trunk*
RE: Fixed second page in output
Posted by Eric Douglas <ed...@blockhouse.com>.
It sounds like that not exactly "first" and "rest" but rather "second"
and "rest" if that's possible.
How ugly it would be to do that depends how you're printing the stuff on
the first and "rest" pages. Do you let it runover with soft pagebreaks?
In my program that would be simple, but I'm just creating my XML from a
program which tells it what to print where and figures out what will fit
on a page. My XSL just reads the page and position values from the XML
and puts everything where I tell it to with absolute positioning.
(with absolute positioning avoiding soft page breaks) If I want to print
something on page 1, then print something special on page 2, then
continue printing other stuff on page 3, I just code the page numbers
into the XML. Then I loop through page breaks with a counter and print
it when I get there..
...
<xsl:variable name="PAGE_NUMBER" select="position()"/>
<fo:block>
<xsl:attribute name="break-before">page</xsl:attribute>
...
</fo:block>
<xsl:for-each select="//PAGE_DATA/SPECIFIC_PAGE">
<fo:block>
<xsl:if test="PAGE_NUMBER = $PAGE_NUMBER">
<xsl:for-each select="*">
...
________________________________
From: Adam Kovacs [mailto:a.kovacs@i-docs.com]
Sent: Friday, July 16, 2010 9:09 AM
To: fop-users@xmlgraphics.apache.org
Subject: Fixed second page in output
Hi There!
I'm currently working on an XSL for a PDF which has a fixed second
page.
The structure is the following:
First page: - Special header and start of table (table goes over more
pages)
Second page: - Static content (an image for example)
Rest: - The rest of the table.
My problem is that the table always goes also into the second page, or
on every odd page only.
I used:
<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first"
master-reference="first"/>
<fo:conditional-page-master-reference page-position="rest"
master-reference="rest"/>
<!--fo:conditional-page-master-reference odd-or-even="even"
master-reference="odd"/> <fo:conditional-page-master-reference
odd-or-even="odd" master-reference="even--"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
but I only need a special handling on the SECOND page...
Anybody had the same problem, or any idea that could help?
I also tried to use a master-reference to another page-sequence-master
with again first and rest but this resulted in NPE:
java.lang.NullPointerException
at org.xml.sax.helpers.LocatorImpl.<init>(LocatorImpl.java:79)
at
org.apache.fop.fo.pagination.PageProductionException.setLocator(PageProd
uctionException.java:56)
Shouldn't this work?
Any help is really welcome!
Adam
Using Fop Trunk