Forcing new Page number

View: New views
2 Messages — Rating Filter:   Alert me  

Forcing new Page number

by abaijal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I am new to fo and am facing a peculiar problem that I am not able to resolve. The business requirement is such that I have a heading page that has a title and rest of the document (ROD) . The ROD page numbers have to start with Page number 1. .i.e Page 2 of the document should have the page number as 1. I wrote the Heading page and ROD in two different page-sequence. When I print this PDF after the first page I have a blank page appearing. This issue arises whenever I put initial-page-number="1" in the second page sequence. If I remove this the document works fine but the first page in ROD has Page number as 2. Any help in this scenario is helpful. Below is my code snippet

 <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>

        <xsl:template match="/">
                <fo:root font-family="TimesNewRoman" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rx="http://www.renderx.com/XSL/Extensions" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
                         xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office">
                        <fo:layout-master-set xmlns:v="urn:schemas-microsoft-com:vml" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
                                <fo:simple-page-master master-name="section1-first-page" page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt" margin-right="54pt" margin-left="45pt">
                                        <fo:region-body margin-top="36pt" margin-bottom="36pt"></fo:region-body>
                                        <fo:region-before region-name="first-page-header" extent="5in"></fo:region-before>
                                        <fo:region-after region-name="first-page-footer" extent="11in" display-align="after"></fo:region-after>
                                </fo:simple-page-master>
                                <fo:simple-page-master master-name="section1-odd-page" page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt" margin-right="54pt" margin-left="45pt">
                                        <fo:region-body margin-top="36pt" margin-bottom="36pt"></fo:region-body>
                                        <fo:region-before region-name="odd-page-header" extent="5in"></fo:region-before>
                                        <fo:region-after region-name="odd-page-footer" extent="11in" display-align="after"></fo:region-after>
                                </fo:simple-page-master>
                                <fo:simple-page-master master-name="section1-even-page" page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt" margin-right="54pt" margin-left="45pt">
                                        <fo:region-body margin-top="36pt" margin-bottom="36pt"></fo:region-body>
                                        <fo:region-before region-name="even-page-header" extent="5in"></fo:region-before>
                                        <fo:region-after region-name="even-page-footer" extent="11in" display-align="after"></fo:region-after>
                                </fo:simple-page-master>
                                <fo:page-sequence-master master-name="section1-page-sequence-master">
                                        <fo:repeatable-page-master-alternatives>
                                                <fo:conditional-page-master-reference odd-or-even="odd" master-reference="section1-odd-page"/>
                                                <fo:conditional-page-master-reference odd-or-even="even" master-reference="section1-even-page"/>
                                        </fo:repeatable-page-master-alternatives>
                                </fo:page-sequence-master>
                        </fo:layout-master-set>
                        <fo:page-sequence master-reference="section1-page-sequence-master"  xmlns:v="urn:schemas-microsoft-com:vml" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:w10="urn:schemas-microsoft-com:office:word"
                                          xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
                                <fo:flow flow-name="xsl-region-body">
                                <fo:block><fo:inline>hello</fo:inline></fo:block>
                                </fo:flow>
                        </fo:page-sequence>

                                                <fo:page-sequence master-reference="section1-page-sequence-master" initial-page-number="1" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:w10="urn:schemas-microsoft-com:office:word"
                                          xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
                                <fo:flow flow-name="xsl-region-body1">
                                <fo:block><fo:inline>hello1</fo:inline></fo:block>
                                </fo:flow>
                        </fo:page-sequence>

                </fo:root>
        </xsl:template>
</xsl:stylesheet>

Re: Forcing new Page number

by Jeremias Maerki-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think the following FAQ entry should help you (independent of the
implementation you use):
http://xmlgraphics.apache.org/fop/faq.html#blank-page-between-page-sequences

On 01.08.2008 16:38:52 abaijal wrote:

>
> Hi
>
> I am new to fo and am facing a peculiar problem that I am not able to
> resolve. The business requirement is such that I have a heading page that
> has a title and rest of the document (ROD) . The ROD page numbers have to
> start with Page number 1. .i.e Page 2 of the document should have the page
> number as 1. I wrote the Heading page and ROD in two different
> page-sequence. When I print this PDF after the first page I have a blank
> page appearing. This issue arises whenever I put initial-page-number="1" in
> the second page sequence. If I remove this the document works fine but the
> first page in ROD has Page number as 2. Any help in this scenario is
> helpful. Below is my code snippet
>
>  <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
>
> <xsl:template match="/">
> <fo:root font-family="TimesNewRoman"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:rx="http://www.renderx.com/XSL/Extensions"
> xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
>         xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
> xmlns:o="urn:schemas-microsoft-com:office:office">
> <fo:layout-master-set xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
> xmlns:w10="urn:schemas-microsoft-com:office:word"
> xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
> <fo:simple-page-master master-name="section1-first-page"
> page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt"
> margin-right="54pt" margin-left="45pt">
> <fo:region-body margin-top="36pt"
> margin-bottom="36pt"></fo:region-body>
> <fo:region-before region-name="first-page-header"
> extent="5in"></fo:region-before>
> <fo:region-after region-name="first-page-footer" extent="11in"
> display-align="after"></fo:region-after>
> </fo:simple-page-master>
> <fo:simple-page-master master-name="section1-odd-page"
> page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt"
> margin-right="54pt" margin-left="45pt">
> <fo:region-body margin-top="36pt"
> margin-bottom="36pt"></fo:region-body>
> <fo:region-before region-name="odd-page-header"
> extent="5in"></fo:region-before>
> <fo:region-after region-name="odd-page-footer" extent="11in"
> display-align="after"></fo:region-after>
> </fo:simple-page-master>
> <fo:simple-page-master master-name="section1-even-page"
> page-width="8.5in" page-height="11in" margin-top="36pt" margin-bottom="36pt"
> margin-right="54pt" margin-left="45pt">
> <fo:region-body margin-top="36pt"
> margin-bottom="36pt"></fo:region-body>
> <fo:region-before region-name="even-page-header"
> extent="5in"></fo:region-before>
> <fo:region-after region-name="even-page-footer" extent="11in"
> display-align="after"></fo:region-after>
> </fo:simple-page-master>
> <fo:page-sequence-master master-name="section1-page-sequence-master">
> <fo:repeatable-page-master-alternatives>
> <fo:conditional-page-master-reference odd-or-even="odd"
> master-reference="section1-odd-page"/>
> <fo:conditional-page-master-reference odd-or-even="even"
> master-reference="section1-even-page"/>
> </fo:repeatable-page-master-alternatives>
> </fo:page-sequence-master>
> </fo:layout-master-set>
> <fo:page-sequence master-reference="section1-page-sequence-master"
> xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
> xmlns:w10="urn:schemas-microsoft-com:office:word"
>                  xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
> <fo:flow flow-name="xsl-region-body">
> <fo:block><fo:inline>hello</fo:inline></fo:block>
> </fo:flow>
> </fo:page-sequence>
>
> <fo:page-sequence master-reference="section1-page-sequence-master"
> initial-page-number="1" xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
> xmlns:w10="urn:schemas-microsoft-com:office:word"
>                  xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
> <fo:flow flow-name="xsl-region-body1">
> <fo:block><fo:inline>hello1</fo:inline></fo:block>
> </fo:flow>
> </fo:page-sequence>
>
> </fo:root>
> </xsl:template>
> </xsl:stylesheet>
> --
> View this message in context: http://www.nabble.com/Forcing-new-Page-number-tp18773619p18773619.html
> Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
>
>




Best regards,
Jeremias Märki
_________________________________________________________
Jeremias Märki, Software-Development and Consulting
Contact Information: http://www.jeremias-maerki.ch/contact.html
Blog: http://www.jeremias-maerki.ch/blog/