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 Martin Edge <Ma...@intellimail.com.au> on 2013/09/05 10:28:12 UTC

SVG Graphics in FOP

Hi Guys,

 

Any idea why when I'm using SVG to draw, it seems to have a whacky concept
of units if I use anything _other_ than no units at all?

 

I used a height of 55mm for instance and it seemed to take up several pages,
and my x/y co-ordinates were not consistent between lines and rectangles
either

 

Thanks

Martin

 

 


Re: SVG Graphics in FOP

Posted by Pascal Sancho <ps...@gmail.com>.
Yes, px is media dependant, so its usage is not recommended.

2013/9/5 Martin Edge <Ma...@intellimail.com.au>:
> Hey Pascal -
>
> Ill give that a go, (the instream sizing might help), trying to steer clear of pixels because I believe that it varies based on FOPs DPI setting and therefore would have mixed results on differing installations
>
> Thanks!
> Martin
>
>
> On 05/09/2013, at 7:04 PM, Pascal Sancho <ps...@gmail.com> wrote:
>
>> Hi,
>>
>> a good practice is to use the (viewBox, height, width) attribute set
>> on svg element;
>> you can leave all your size values without unit (defaulting to px or
>> pt, I don't remember).
>>
>> ... And explicitly add your preferred unit on both svg/@width and svg/@height.
>>
>> Another option is to use FO content-* properties on
>> fo:instream-foreign-object or fo:external-graphic,
>> and leave svg/@width and svg/@height without unit.
>>
>> <fo:block font-size="0pt">
>>  <fo:instream-foreign-object content-height="24pt" content-width="48pt">
>>    <svg xmlns="http://www.w3.org/2000/svg"
>>        viewBox="0 0 48 24" height="24pt" width="48pt">
>>      <g style="fill: none; stroke:black; stroke-width:0.25;">
>>        <line y2="12" x2="48" y1="12" x1="0"/>
>>        <line y2="24" x2="24" y1="0" x1="24"/>
>>        <circle r="6" cy="12" cx="24"/>
>>      </g>
>>    </svg>
>>  </fo:instream-foreign-object>
>> </fo:block>
>>
>> 2013/9/5 Martin Edge <Ma...@intellimail.com.au>:
>>> Hi Guys,
>>>
>>>
>>>
>>> Any idea why when I’m using SVG to draw, it seems to have a whacky concept
>>> of units if I use anything _other_ than no units at all?
>>>
>>>
>>>
>>> I used a height of 55mm for instance and it seemed to take up several pages,
>>> and my x/y co-ordinates were not consistent between lines and rectangles
>>> either
>>>
>>>
>>>
>>> Thanks
>>>
>>> Martin
>>
>>
>>
>> --
>> pascal
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
pascal

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


Re: SVG Graphics in FOP

Posted by Martin Edge <Ma...@intellimail.com.au>.
Hey Pascal -

Ill give that a go, (the instream sizing might help), trying to steer clear of pixels because I believe that it varies based on FOPs DPI setting and therefore would have mixed results on differing installations 

Thanks! 
Martin 


On 05/09/2013, at 7:04 PM, Pascal Sancho <ps...@gmail.com> wrote:

> Hi,
> 
> a good practice is to use the (viewBox, height, width) attribute set
> on svg element;
> you can leave all your size values without unit (defaulting to px or
> pt, I don't remember).
> 
> ... And explicitly add your preferred unit on both svg/@width and svg/@height.
> 
> Another option is to use FO content-* properties on
> fo:instream-foreign-object or fo:external-graphic,
> and leave svg/@width and svg/@height without unit.
> 
> <fo:block font-size="0pt">
>  <fo:instream-foreign-object content-height="24pt" content-width="48pt">
>    <svg xmlns="http://www.w3.org/2000/svg"
>        viewBox="0 0 48 24" height="24pt" width="48pt">
>      <g style="fill: none; stroke:black; stroke-width:0.25;">
>        <line y2="12" x2="48" y1="12" x1="0"/>
>        <line y2="24" x2="24" y1="0" x1="24"/>
>        <circle r="6" cy="12" cx="24"/>
>      </g>
>    </svg>
>  </fo:instream-foreign-object>
> </fo:block>
> 
> 2013/9/5 Martin Edge <Ma...@intellimail.com.au>:
>> Hi Guys,
>> 
>> 
>> 
>> Any idea why when I’m using SVG to draw, it seems to have a whacky concept
>> of units if I use anything _other_ than no units at all?
>> 
>> 
>> 
>> I used a height of 55mm for instance and it seemed to take up several pages,
>> and my x/y co-ordinates were not consistent between lines and rectangles
>> either
>> 
>> 
>> 
>> Thanks
>> 
>> Martin
> 
> 
> 
> -- 
> pascal
> 
> ---------------------------------------------------------------------
> 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


Re: SVG Graphics in FOP

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

a good practice is to use the (viewBox, height, width) attribute set
on svg element;
you can leave all your size values without unit (defaulting to px or
pt, I don't remember).

... And explicitly add your preferred unit on both svg/@width and svg/@height.

Another option is to use FO content-* properties on
fo:instream-foreign-object or fo:external-graphic,
 and leave svg/@width and svg/@height without unit.

<fo:block font-size="0pt">
  <fo:instream-foreign-object content-height="24pt" content-width="48pt">
    <svg xmlns="http://www.w3.org/2000/svg"
        viewBox="0 0 48 24" height="24pt" width="48pt">
      <g style="fill: none; stroke:black; stroke-width:0.25;">
        <line y2="12" x2="48" y1="12" x1="0"/>
        <line y2="24" x2="24" y1="0" x1="24"/>
        <circle r="6" cy="12" cx="24"/>
      </g>
    </svg>
  </fo:instream-foreign-object>
</fo:block>

2013/9/5 Martin Edge <Ma...@intellimail.com.au>:
> Hi Guys,
>
>
>
> Any idea why when I’m using SVG to draw, it seems to have a whacky concept
> of units if I use anything _other_ than no units at all?
>
>
>
> I used a height of 55mm for instance and it seemed to take up several pages,
> and my x/y co-ordinates were not consistent between lines and rectangles
> either
>
>
>
> Thanks
>
> Martin
>
>
>
>



-- 
pascal

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