You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Rea, Matthew" <Ma...@auspost.com.au> on 2004/07/05 08:46:59 UTC

SVG image rounding issue

Hi all,
 
I am using SVG images in a FOP generated PDF and am seeing an issue where
the image width and height are rounded/clipped/truncated, however you want
to put it, when I view the output PDF.  
 
For example the following SVG created in Adobe Illustrator has the following
dimensions:
 
<svg  xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
             width="70.914" height="79.441" viewBox="0 0 70.914 79.441"
overflow="visible" enable-background="new 0 0 70.914 79.441"
             xml:space="preserve">
 
The problem is when you look at the PDF result in Macromedia Freehand or
Adobe Illustrator the image size is given as:
Width = 70pt
Height = 79pt
 
Where has the decimal precision gone?  I am using FOP 0.20.5 on WinXP with
JDK 1.3.1_03.
 
The thing is I see the same behavior when I use Batik to convert the SVG to
a raster image format so I am posting here to see if it is a known issue.  I
have investigated the lists and the docs and can find nothing.  Has anyone
else seen this?  Or am I missing something really obvious?  Any ideas?
 
Best regards,
 
Matt 
 
Matthew Rea
 
 


Australia Post is committed to providing our customers with excellent service. If we can assist you in any way please telephone 13 13 18 or visit our website www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential information intended for the use of the addressee. The confidentiality and/or privilege in this e-mail is not waived, lost or destroyed if it has been transmitted to you in error. If you have received this e-mail in error you must (a) not disseminate, copy or take any action in reliance on it; (b) please notify Australia Post immediately by return e-mail to the sender; and (c) please delete the original e-mail.

Re: SVG image rounding issue

Posted by Thomas DeWeese <Th...@Kodak.com>.
Rea, Matthew wrote:

> I am using SVG images in a FOP generated PDF and am seeing an issue 
> where the image width and height are rounded/clipped/truncated, however 
> you want to put it, when I view the output PDF. 

> <svg width="70.914" height="79.441" viewBox="0 0 70.914 79.441" [...] >

> The problem is when you look at the PDF result in Macromedia Freehand or 
> Adobe Illustrator the image size is given as:
> 
> Width = 70pt
> Height = 79pt
> 
> Where has the decimal precision gone?  I am using FOP 0.20.5 on WinXP 
> with JDK 1.3.1_03.

    The PDF transcoder is based on the Image transcoder which as you
notice truncates the width/height to the nearest integer.  I don't
believe there is any requirement that this happen for PDF, it is just
how it is currently done.

> The thing is I see the same behavior when I use Batik to convert the SVG 
> to a raster image format so I am posting here to see if it is a known 
> issue.  I have investigated the lists and the docs and can find 
> nothing.  Has anyone else seen this?  Or am I missing something really 
> obvious?  Any ideas?

    This truncation _is_ required for 'raster' formats because they
can only contain integer numbers of pixels, there is no way to output
half a pixel.  The baseclass for the PDF transcoder was written with
raster formats in mind and this is why it truncated.


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