From: Pascal Sancho [mailto:[EMAIL PROTECTED]
Sent: Fri 7/7/2006 3:55 AM
To: [email protected]
Subject: RE: FOP inserting white space into SVG images
> -----Original Message-----
> From: Coutcher, Joseph James [mailto:[EMAIL PROTECTED]]
>
> Anyone have any ideas as to why this is happening? Thanks!
> ________________________________
> From: Coutcher, Joseph James [mailto:[EMAIL PROTECTED]]
>
> I have provided the sample output I'm getting at the following URL:
>
> http://www.eng.utoledo.edu/~jcoutche/fop.pdf
> <http://www.eng.utoledo.edu/~jcoutche/fop.pdf>
>
> Maybe "white space" wasn't the best description of the
> problem. Take a look at the image in the PDF. Now, look at
> the image size in the FO document (content-width,
> content-height, and viewBox):
>
> <fo:instream-foreign-object
> content-width="180.8mm" content-height="30.0mm"
> background-color="red">
> <svg:svg viewBox="0 0 180 30">
> <svg:rect x="0" y="0" width="180"
> height="30" fill="none" stroke="black" />
> </svg:svg>
> </fo:instream-foreign-object>
>
> As you will notice, the size I defined for it is rectangular,
> and not the square shape as FOP is rendering it as.
>
> I have tried using instream-foreign-object and
> external-graphic (with content-width="180.8mm"
> content-height="30.0mm" background-color="red"), and I get
> the same results. Yet, if I have a PNG file of the same
> dimensions, and use the exact same external-graphic element
> with the exact same parameters, it renders how it should.
>
> This is the expected output:
> http://eng.utoledo.edu/~jcoutche/fop2.pdf
>
> The graphic I'm using needs to stay as an SVG, as I would
> rather it be embedded directly in the XML document.
Hi JJ,
Reading the svg spec, width and height attributes default to 100% for
the svg element [1].
I have not found 100% of what?? SomeOne else?
You should give them an explicite value, i.e.:
<svg:svg viewBox="0 0 180 30" width="180" height="30">
(you can remove viewBox attribute [2], that is usually used to clip or
scale your image when set to svg element [4] & [5]).
If ViewBox and width/height rectangles differ, you shoud use the
preserveAspectRatio attribute [3] too.
[1] http://www.w3.org/TR/SVG11/struct.html#SVGElement
[2] http://www.w3.org/TR/SVG11/coords.html#ViewBoxAttribute
[3] http://www.w3.org/TR/SVG11/coords.html#PreserveAspectRatioAttribute
[4] http://www.w3.org/TR/SVG11/coords.html#ViewportSpace
[5] http://www.w3.org/TR/SVG11/masking.html#InitialClippingPath
HTH,
Pascal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
