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 Zahidul Islam <fa...@yahoo.com> on 2003/05/27 08:43:19 UTC

using in all the pages

hello
       i am trying to positioning every information on a pdf file by using <fo:block-container> it is working fine for single page , i mean for the first page. how can i fixed the position of something in the 2nd ..page.
i have also another question. let in pdf the first element is shown in a block then some info is shown using <fo:block-container> at some fixed position. then if i show some info by using <fo:block> then it shows after the previous block, but i want to show it after everything that are already in the pdf(including <block> and <block-container>).
 
pls help me


---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.

Re: using in all the pages

Posted by Zahidul Islam <fa...@yahoo.com>.
hello
       i am facing a problem regarding which i sent en email. the problem is explained here:

The xml file is shown here:


<start>
<generalinfo>
<component top="150" left="20" width="100" height="20"> GI 1</component>
<component top="150" left="120" width="100" height="20"> GI 2</component>
<component top="200" left="20" width="100" height="20"> GI 3</component>
<component top="200" left="120" width="100" height="20"> GI 4</component>
</generalinfo>
<userdefined name="User Defined Data">
<table top="1100" left="120" width="400" height="300"> 
<!-- the table will be show in the next(2nd) page with top='300' -->
<tbody>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
<tr>
<td>A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
<td>D</td>
</tr>
</tbody>
</table>
</userdefined> 
<lastinfo>
<!-- these informations will be show in the next(2nd) page with top='600' -->
<component top="1400" left="20" width="100" height="20"> GI 1</component>
<component top="1400" left="120" width="100" height="20"> GI 2</component>
</lastinfo>

</start>

To show the contents in pdf file at there fixed position i use 
<fo:block-container> and its attributes(top,left,width,height)
is set from the xml file. the xsl file is as follows :

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

<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master master-name="only" page-width="210mm" 
page-height="900px" margin-top="0.5in" margin-bottom="0.5in" 
margin-left="0.3in" margin-right="0.2in">
<fo:region-start extent="0.3in"/>
<fo:region-before extent="0.5in"/>
<fo:region-body margin="0.5in"/>
<fo:region-end extent="0.2in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="only" initial-page-number="1">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>

</fo:root>
</xsl:template>
 
<xsl:template match="generalinfo">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="generalinfo">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="component">
<fo:block-container position="absolute">
<xsl:attribute name="top">
<xsl:value-of select="px'>./@top"/>px
</xsl:attribute>
<xsl:attribute name="left">
<xsl:value-of select="px'>./@left"/>px
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="px'>./@width"/>px
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="px'>./@height"/>px
</xsl:attribute>
<fo:block>
<xsl:value-of select="text()"/>
</fo:block>
</fo:block-container>
</xsl:template>
 
<xsl:template match="userdefined">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="table">
<fo:block-container position="absolute">
<xsl:attribute name="top">
<xsl:value-of select="px'>./@top"/>px
</xsl:attribute>
<xsl:attribute name="left">
<xsl:value-of select="px'>./@left"/>px
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="px'>./@width"/>px
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="px'>./@height"/>px
</xsl:attribute>

<fo:block>
<xsl:apply-templates/>
</fo:block>

</fo:block-container>
</xsl:template>

<xsl:template match="tbody">
<fo:table>
<xsl:for-each select="tr[1]/th">
<fo:table-column column-width="150px"/>
</xsl:for-each>

<fo:table-body>
<xsl:apply-templates/>
</fo:table-body>
</fo:table>
</xsl:template>
 
<xsl:template match="tr">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
 
<xsl:template match="th">
<fo:table-cell font-weight="bold" text-align="center">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
 
<xsl:template match="td">
<fo:table-cell>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
 
</xsl:stylesheet>


But unfortunately it is not working. if i made the
top attribute of the table element in the xml file
and use <fo:block break-before="page"> for a template 
match of <xsl:template match="table"> then it works 
fine. isthere any other way to solve this? i mean 
depending on the value(of top ) from the xml the 
formatter will itself show the content in the next
page.

pls help me.


---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Re: using in all the pages

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Zahidul Islam wrote:
> i am trying to positioning every information on a pdf file by using
> <fo:block-container> it is working fine for single page , i mean for the
> first page. how can i fixed the position of something in the 2nd ..page.

Insert a <fo:block break-before="page"/> in order to create a
page break.


> have also another question. let in pdf the first element is shown in a block
> then some info is shown using <fo:block-container> at some fixed position.
> then if i show some info by using <fo:block> then it shows after the previous
> block, but i want to show it after everything that are already in the
> pdf(including <block> and <block-container>).

I'm not sure what you want to achieve, but you could take a look
at fo:footnote.

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org