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 "Chakravarty, Abhishek" <Ab...@accidentfund.com> on 2009/01/07 20:00:47 UTC

RE: Force page break to skip immediate next page and continue writing on third page

I eventually did manage to get by this problem. The way out was to
enforce an extent = 0 for the region body when it came to printing page
2. Also to ensure that there was always a page 2 irrespective of whether
the region body overflowed (from page 1 or not) or not was having the
force-page-count = even. 

 

Refer to the xsl below

 

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

 

            <xsl:template match="/">

                        <fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format">

                                    <fo:layout-master-set>

                                                <fo:page-sequence-master
master-name="SIMPLE" >

 
<fo:repeatable-page-master-alternatives>

 
<fo:conditional-page-master-reference master-reference="FRONT"

 
odd-or-even="odd"

 
master-name="FRONT" />

 
<fo:conditional-page-master-reference master-reference="BACK"

 
odd-or-even="even"

 
master-name="BACK" />

 
</fo:repeatable-page-master-alternatives>

 
</fo:page-sequence-master>

                                                

                                                <fo:simple-page-master
master-name="FRONT" page-height="28.5cm" page-width="21.6cm"
margin-top="1.5cm" margin-bottom="0cm" margin-left="0.5cm"
margin-right="0.5cm">

 
<fo:region-body extent="9cm" margin-top="11cm" margin-bottom="3cm"/>

 
<fo:region-before extent="8cm" margin-top="1cm"/>

                                                </fo:simple-page-master>

                                                <fo:simple-page-master
master-name="BACK" page-height="28.5cm" page-width="21.6cm"
margin-top="1.5cm" margin-bottom="0cm" margin-left="0.5cm"
margin-right="0.5cm">

 
<fo:region-body extent="0cm" margin-top="14cm" margin-bottom="13cm"/>

 
<fo:region-after extent="15cm" margin-top="6cm" />

                                                </fo:simple-page-master>

                                    </fo:layout-master-set>

                                    

                                    <fo:page-sequence
master-reference="SIMPLE" force-page-count="even"
initial-page-number="auto-odd">

                                                <fo:static-content
flow-name="xsl-region-before" font-family="Helvetica">

                                                            <fo:block>
HEADER</fo:block>

                                                </fo:static-content>

 

                                                <fo:static-content
flow-name="xsl-region-after" font-family="Helvetica" >

                                                            <fo:block
>Footer</fo:block>

                                                </fo:static-content>

                                                

                                                <fo:flow
flow-name="xsl-region-body">

                                                <fo:table height="4cm"
width="5cm" table-layout="fixed" >

 
<fo:table-body>

 
<xsl:for-each select="data/table/record">

 
<fo:table-row>

 
<fo:table-cell>


 
<fo:block>row</fo:block>            

 
</fo:table-cell>

 
</fo:table-row>

 
</xsl:for-each>

 
</fo:table-body>

                                                </fo:table>

                                                </fo:flow>

                                                

                                    </fo:page-sequence>

                        </fo:root>

            </xsl:template>

 

</xsl:stylesheet>

 

________________________________

From: Chakravarty, Abhishek [mailto:AbhisheC@accidentfund.com] 
Sent: Tuesday, December 16, 2008 11:28 AM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Force page break to skip immediate next page and continue
writing on third page

 

Yes. I had gone through the mailing list as well but was hoping that
this had been fixed since then. Unfortunately that does not seem to be
the case. :-(

 

Thanks Eric, Jeremias and Barry for all those inputs.

 

 

________________________________

From: Amick, Eric [mailto:Eric.Amick@mail.house.gov] 
Sent: Tuesday, December 16, 2008 8:37 AM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Force page break to skip immediate next page and continue
writing on third page

 

I found this in the mailing list archives, for what it's worth....

 

From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Friday, June 15, 2007 1:28 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: flow does not map to the region-body error
 
Well, as the error message says, FOP doesn't support that, yet. FOP
currently expects that the flow-name of the fo:flow maps to the
region-body in the simple-page-master.
 
If it were:
<fo:flow flow-name="xsl-region-body">
it would work.
 
I know this is generally possible, but I guess it is too exotic and
nobody cared to implement that possibility, yet.
 
Obviously no one has implemented it since then.

 

Eric Amick

Legislative Computer Systems

Office of the Clerk

 

 

________________________________

From: Chakravarty, Abhishek [mailto:AbhisheC@accidentfund.com] 
Sent: Tuesday, December 16, 2008 8:17
To: fop-users@xmlgraphics.apache.org
Subject: RE: Force page break to skip immediate next page and continue
writing on third page

I ran the transform just to generate the FO and subsequently tried to
generate the pdf from that fo and found that as long as the header text
was limited and not overflowing into the next page it was doing
fine(i.e. pdf generated) but as soon as the header overflowed from page
1 ('simple') then I ran into the same error as previous...

 

Error: Flow 'xsl-region-body' does not map to the region-body in
page-master 'blank-page'. FOP presently does not support this.

 

The FO generated from the transform is below. Plz let me know if there
is something that needs to be corrected in this.

 

 

<?xml version="1.0" encoding="UTF-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

      <fo:layout-master-set>

            <fo:page-sequence-master master-name="document">

                  <fo:single-page-master-reference
master-reference="simple"/>

                  <fo:single-page-master-reference
master-reference="blank-page"/>

                  <fo:repeatable-page-master-reference
master-reference="simple"/>

            </fo:page-sequence-master>

            <fo:simple-page-master page-width="21.6cm"
page-height="18.5cm" master-name="simple">

                  <fo:region-body/>

                  <fo:region-after/>

            </fo:simple-page-master>

      

            <fo:simple-page-master page-width="21.6cm"
page-height="18.5cm" master-name="blank-page">

                  <fo:region-body region-name="blank"/>

                  <fo:region-after/>

            </fo:simple-page-master>

      </fo:layout-master-set>

      

      <fo:page-sequence master-reference="document">

            <fo:static-content flow-name="blank">

                  <fo:block font-family="Helvetica" font-weight="bold"
font-size="32pt">

                        FOOTER TEXT

                  </fo:block>

            </fo:static-content>

            

            <fo:flow flow-name="xsl-region-body">

                  <fo:block font-family="Helvetica" font-weight="bold"
font-size="32pt">

                        HEADER TEXT..Sample Text....Sample
Text....Sample Text....Sample Text....Sample Text....Sample Text....

                        Sample Text....Sample Text....Sample
Text....Sample Text....Sample Text....Sample Text....Sample Text..

                        ..Sample Text....Sample Text....Sample
Text....Sample Text....Sample Text....Sample Text....Sample Text..

                        ..Sample Text....Sample Text....Sample
Text....Sample Text....Sample Text....Sample Text....Sample Text..

                        ..Sample Text....

                  </fo:block>

            </fo:flow>

      </fo:page-sequence>

</fo:root>

 

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Tuesday, December 16, 2008 3:38 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Force page break to skip immediate next page and continue
writing on third page

 

Abhishek,

 

I don't think you're hitting a limitation of FOP. Eric has a point. It

appears that the FO you're generating is not valid and that's why FOP

shows errors. To debug the situation I suggest you take FOP out of the

picture for the moment and just run your XSLT transformation. Then take

a look at the FO file that is generated and fix your stylesheet as

necessary. As a convenience, FOP offers to run just the XSLT

transformation on the command-line:

fop -xml my.xml -xsl my.xml -foout out.fo

 

It can be difficult to debug problems if you always run both the XSLT

transformation and the FO layout at the same time.

 

Good luck!

 

On 15.12.2008 21:10:42 Chakravarty, Abhishek wrote:

> Yes, I am using an xsl and xml to generate my pdf through FOP 0.95

> instead of using only an FO file. 

> 

> However I am able to generate an FO from my xsl and xml but unable to

> generate the pdf itself either by a combination of the xsl and xml or

> just through fo alone.

> 

> So this may just be a limitation of FOP. If nothing else works, I will

> probably be looking at iText to solve this issue now. 

> 

>  

> 

> ________________________________

> 

> From: Amick, Eric [mailto:Eric.Amick@mail.house.gov] 

> Sent: Monday, December 15, 2008 3:02 PM

> To: fop-users@xmlgraphics.apache.org

> Subject: RE: Force page break to skip immediate next page and continue

> writing on third page

> 

>  

> 

> It may well be true for FOP. I believe what I have in mind is legal
FO;

> maybe someone else knows for certain.

> 

>  

> 

> Eric Amick

> 

> Legislative Computer Systems

> 

> Office of the Clerk

> 

<snip/>  

 

 

Jeremias Maerki

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org

For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org