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 Ulrich Mayring <ul...@denic.de> on 2009/01/14 19:45:10 UTC

SVG positioning problem

Hi folks,

since upgrading from FOP 0.20.5 to 0.95 the positioning of my SVG elements 
changed. In my FO I am basically doing this:

<fo:block-container position="absolute" left="0.5cm" top="20cm" height="1cm" 
width="0.5cm">
   <fo:block>
     <fo:instream-foreign-object>
       <svg:svg height="0.5cm" width="0.5cm">
         <svg:rect height="0.2pt" width="0.5cm" y="0cm" x="0cm"/>
       </svg:svg>
     </fo:instream-foreign-object>
   </fo:block>
</fo:block-container>

My understanding is that this should lead to a line positioned 20cm from the 
top of the page. However, the line appears 19.8cm from the top. 
Interestingly, if I change the "20cm" to "10cm" in the block-container's top 
attribute, then the line is positioned 10.2cm from the top. So the difference 
is 2mm in both cases. Going halfway between these cases, using "15cm" as 
value, the line is positioned exactly right.

Perhaps I should do my SVG positioning differently than with a 
block-container? Browsing through FOP's svg examples didn't provide any 
immediate insight...

The FO file is available upon request.

Many thanks in advance,

Ulrich


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


Re: SVG positioning problem

Posted by Ulrich Mayring <ul...@denic.de>.
Peter Coppens wrote:
> I struggled with something similar
>
> See http://markmail.org/message/5ppuwom7arnzqjy7
>
> The solution provided was to set font-size="0pt"

I changed my FO according to your example:

<fo:block-container absolute-position="fixed" left="0.5cm" top="10cm" 
height="1cm" width="0.5cm">
   <fo:block font-size="0pt">
     <fo:instream-foreign-object>
       <svg:svg height="0.5cm" width="0.5cm">
         <svg:line x1="0cm" y1="0cm" x2="0.5cm" y2="0cm" 
style="stroke:rgb(0,0,0);stroke-width:0.2pt"/>
       </svg:svg>
     </fo:instream-foreign-object>
   </fo:block>
</fo:block-container>

But this has no effect, I am still getting the same offset. Unfortunately the 
offset changes all over the page, so I cannot correct it by adding some fixed 
value.

Ulrich


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


Re: SVG positioning problem

Posted by Peter Coppens <pc...@gmail.com>.
I struggled with something similar

See http://markmail.org/message/5ppuwom7arnzqjy7

The solution provided was to set font-size="0pt"

Hope this helps,

Peter

> From: Ulrich Mayring <ul...@denic.de>
> Reply-To: <fo...@xmlgraphics.apache.org>
> Date: Wed, 14 Jan 2009 19:45:10 +0100
> To: <fo...@xmlgraphics.apache.org>
> Subject: SVG positioning problem
> 
> Hi folks,
> 
> since upgrading from FOP 0.20.5 to 0.95 the positioning of my SVG elements
> changed. In my FO I am basically doing this:
> 
> <fo:block-container position="absolute" left="0.5cm" top="20cm" height="1cm"
> width="0.5cm">
>    <fo:block>
>      <fo:instream-foreign-object>
>        <svg:svg height="0.5cm" width="0.5cm">
>          <svg:rect height="0.2pt" width="0.5cm" y="0cm" x="0cm"/>
>        </svg:svg>
>      </fo:instream-foreign-object>
>    </fo:block>
> </fo:block-container>
> 
> My understanding is that this should lead to a line positioned 20cm from the
> top of the page. However, the line appears 19.8cm from the top.
> Interestingly, if I change the "20cm" to "10cm" in the block-container's top
> attribute, then the line is positioned 10.2cm from the top. So the difference
> is 2mm in both cases. Going halfway between these cases, using "15cm" as
> value, the line is positioned exactly right.
> 
> Perhaps I should do my SVG positioning differently than with a
> block-container? Browsing through FOP's svg examples didn't provide any
> immediate insight...
> 
> The FO file is available upon request.
> 
> Many thanks in advance,
> 
> Ulrich
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 



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