Hi Sean,

> > Sean Wheller <[EMAIL PROTECTED]> wrote on 01/02/2007 06:52:56 AM:
> >  > It seems that setting the canvas size smaller is not the solution.
> >  > Batik still renders an image with a huge amount of wasted space.

> On Tuesday 02 January 2007 14:49, [EMAIL PROTECTED] wrote:
> > What you probably want to have is a viewBox as well as a width
> > and height.   Something like:
> > <svg
> >     width="452.64005pt"
> >     height="320.53pt"
> >     viewBox="0 0 452.64 320.53"
> >     [... the rest of the attrs ...]

Sean Wheller <[EMAIL PROTECTED]> wrote on 01/02/2007 08:20:40 AM:

> I am aware of the view box option and it does work when passed at the 
command 
> line. [...]

> Surely, there must be a way of doing this in an automated fashion. The 
whole 
> documentation system is docbook, built using ant so I guess it can be 
done.
> 
> How can I use the getBBox you mentioned in earlier post?

   Well if you can add an 'onload' event handler to the root SVG element
(might be possible in docbook using a stylsheet) it is pretty simple
(note that this is using Java from Javascript to print the result):

        onload="System.err.println('BBox: ' + 
document.getRootElement().getBBox())"

   Getting it in Java is roughly the same but you need to do some casting 
in
some places.  If you can add the Javascript onload event attribute then 
the
onload script can add the viewBox attribute at that point and it will be 
respected during transcoding.

   To do it in Java however you will probably need to modify the
SVGAbstractTranscoder (the preserveAspectRatio transform calculation 
starts at around line 240).

   I might look into adding an 'auto-aoi' command line option.

Reply via email to