Hi Sean,

Sean Wheller <[EMAIL PROTECTED]> wrote on 12/30/2006 09:03:13 AM:

> I am using batik to generate PNG from SVG created using Inkscape.

> The PNG files are output but they contain the whole canvas size as 
defined in 
> the SVG source by Inkscape.

> width="595.27557pt"
> height="841.88977pt"

   As the SVG specification says they should.  The Width/Height say
what size canvas the document should be drawn into.

> This results in the actual picture that is drawn on the canvas being 
> surrounded by a large whitespace. Obviously when such images are 
included in 
> a web page or PDF the result is not desired.

   Actually the surround should be transparent, although it is still
wasteful.

> How can I tell batik to render only the picture and not the canvas?

   Write code to make Batik non-conformant.  You could also try adding
script to your documents change the width, height and viewBox attributes 
based on the return value of 'getBBox' on the outermost SVG element.

> I cannot guarantee that the picture drawn will always be at the same 
> coordinates on the canvas.

   There is also no good reason that the bounds of the geometry in
the document will describe the desired region to render (it
is quite common for very large rectangles to be put in documents
as backgrounds, however the content of interest may only cover a
small portion of the rect).  In the general case this is something
that only the author of the document can do which is why there is
the viewBox attribute.

Reply via email to