File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes XSL FO: forcing page numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "XSL FO: forcing page numbers" Watch "XSL FO: forcing page numbers" New topic
Author

XSL FO: forcing page numbers

ashish baijal
Greenhorn

Joined: Aug 01, 2008
Posts: 1
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 utput 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 ="urn:schemas-microsoft-com ffice ffice">
<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 ffice:word" xmlns t="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 age-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 age-sequence-master>
</fo:layout-master-set>
<fo age-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 ffice:word"
xmlns t="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 age-sequence>

<fo age-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 ffice:word"
xmlns t="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 age-sequence>

</fo:root>
</xsl:template>
</xsl:stylesheet>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSL FO: forcing page numbers