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 Eric Douglas <ed...@blockhouse.com> on 2011/05/13 20:20:33 UTC

How do I set page margins?

The basic page margin is in the page setup.

<fo:simple-page-master>
<xsl:attribute name="margin-top"><xsl:value-of
select="MT"/></xsl:attribute>

This works at the top level but sets the same margin for all pages.
What if I want each page to be different?
I can assign this attribute from an xsl:variable if I create that
variable above the <fo:layout-master-set> section.
If I assign a value for it down below within the <fo:page-sequence> it
doesn't seem to have an effect.

I generate the XML myself to calculate what goes on each page, so the
page processing looks like this.
<fo:page-sequence>
<fo:flow>
<xsl:for-each select="PD">
<fo:block>
<xsl:attribute name="break-before">page</xsl:attribute>

I tried moving that margin-top attribute to that fo:block and it doesn't
look like it's having any effect, though it does indent my text blocks
if I add a margin-left to that block.

Re: How do I set page margins?

Posted by Pascal Sancho <pa...@takoma.fr>.
Hi Eric,

After a page-break, there is a new reference-area. For a block at the
beginning of the reference-area, the space-before is taken into account
if the space-before.conditionality property is set to 'retain' (see XSL
REC 1.1, $4.3 at [1]).
And this property default to 'discard' (see $7.11.5 at [2]).

[1] http://www.w3.org/TR/xsl/#spacecond
[2] http://www.w3.org/TR/xsl/#space-before

Le 13/05/2011 20:20, Eric Douglas a écrit :
> The basic page margin is in the page setup.
> 
> <fo:simple-page-master>
> <xsl:attribute name="margin-top"><xsl:value-of
> select="MT"/></xsl:attribute>
> 
> This works at the top level but sets the same margin for all pages.
> What if I want each page to be different?
> I can assign this attribute from an xsl:variable if I create that
> variable above the <fo:layout-master-set> section.
> If I assign a value for it down below within the <fo:page-sequence> it
> doesn't seem to have an effect.
> 
> I generate the XML myself to calculate what goes on each page, so the
> page processing looks like this.
> <fo:page-sequence>
> <fo:flow>
> <xsl:for-each select="PD">
> <fo:block>
> <xsl:attribute name="break-before">page</xsl:attribute>
> 
> I tried moving that margin-top attribute to that fo:block and it doesn't
> look like it's having any effect, though it does indent my text blocks
> if I add a margin-left to that block.
> 

-- 
Pascal

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


RE: How do I set page margins?

Posted by Eric Douglas <ed...@blockhouse.com>.
If I'm reading this right, you're suggesting I hard code any margins I
might want into different 

________________________________

From: Rob Sargent [mailto:rsargent@xmission.com] 
Sent: Friday, May 13, 2011 2:47 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: How do I set page margins?




On 05/13/2011 12:20 PM, Eric Douglas wrote: 

	The basic page margin is in the page setup. 

	<fo:simple-page-master> 
	<xsl:attribute name="margin-top"><xsl:value-of
select="MT"/></xsl:attribute> 

	This works at the top level but sets the same margin for all
pages. 
	What if I want each page to be different? 
	I can assign this attribute from an xsl:variable if I create
that variable above the <fo:layout-master-set> section. 
	If I assign a value for it down below within the
<fo:page-sequence> it doesn't seem to have an effect. 

	I generate the XML myself to calculate what goes on each page,
so the page processing looks like this. 
	<fo:page-sequence> 
	<fo:flow> 
	<xsl:for-each select="PD"> 
	<fo:block> 
	<xsl:attribute name="break-before">page</xsl:attribute> 

	I tried moving that margin-top attribute to that fo:block and it
doesn't look like it's having any effect, though it does indent my text
blocks if I add a margin-left to that block.


I suspect you have to define your simple-page-masters, filling in the
margin values, then lay out their order of appearance(s) in a
page-sequence-master.



RE: How do I set page margins?

Posted by Eric Douglas <ed...@blockhouse.com>.
If I'm reading this right, you're suggesting I hard code any margins I
might want into different simple-page-master tags and change the
references on the page-sequences to choose one of those.
I'm actually programmatically generating xml data to absolute position
all text and graphics, so if it won't accept margins as a variable to
allow different amounts for each page, I'm just using a workaround to
pass the margins as a variable to be added in to the absolute
positioning of each item.  I tested that and it's just writing the
calculation rather than the result to the position attributes in the fo
data but it works.

________________________________

From: Rob Sargent [mailto:rsargent@xmission.com] 
Sent: Friday, May 13, 2011 2:47 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: How do I set page margins?




On 05/13/2011 12:20 PM, Eric Douglas wrote: 

	The basic page margin is in the page setup. 

	<fo:simple-page-master> 
	<xsl:attribute name="margin-top"><xsl:value-of
select="MT"/></xsl:attribute> 

	This works at the top level but sets the same margin for all
pages. 
	What if I want each page to be different? 
	I can assign this attribute from an xsl:variable if I create
that variable above the <fo:layout-master-set> section. 
	If I assign a value for it down below within the
<fo:page-sequence> it doesn't seem to have an effect. 

	I generate the XML myself to calculate what goes on each page,
so the page processing looks like this. 
	<fo:page-sequence> 
	<fo:flow> 
	<xsl:for-each select="PD"> 
	<fo:block> 
	<xsl:attribute name="break-before">page</xsl:attribute> 

	I tried moving that margin-top attribute to that fo:block and it
doesn't look like it's having any effect, though it does indent my text
blocks if I add a margin-left to that block.


I suspect you have to define your simple-page-masters, filling in the
margin values, then lay out their order of appearance(s) in a
page-sequence-master.



Re: How do I set page margins?

Posted by Rob Sargent <rs...@xmission.com>.

On 05/13/2011 12:20 PM, Eric Douglas wrote:
>
> The basic page margin is in the page setup.
>
> <fo:simple-page-master>
> <xsl:attribute name="margin-top"><xsl:value-of 
> select="MT"/></xsl:attribute>
>
> This works at the top level but sets the same margin for all pages.
> What if I want each page to be different?
> I can assign this attribute from an xsl:variable if I create that 
> variable above the <fo:layout-master-set> section.
> If I assign a value for it down below within the <fo:page-sequence> it 
> doesn't seem to have an effect.
>
> I generate the XML myself to calculate what goes on each page, so the 
> page processing looks like this.
> <fo:page-sequence>
> <fo:flow>
> <xsl:for-each select="PD">
> <fo:block>
> <xsl:attribute name="break-before">page</xsl:attribute>
>
> I tried moving that margin-top attribute to that fo:block and it 
> doesn't look like it's having any effect, though it does indent my 
> text blocks if I add a margin-left to that block.
>

I suspect you have to define your simple-page-masters, filling in the 
margin values, then lay out their order of appearance(s) in a 
page-sequence-master.