Hi Geert,
Geert-Jan Giezeman <[email protected]> wrote on 02/27/2009 07:13:11 AM:
> I am new to Batik and I am trying to use Batik in order to convert svg
> content to some custom vector file format. So, it is a task somewhat
> similar to a PDFTranscoder.
As you may be aware the PDFTranscoder works by implementing
the Java Graphics2D interface, and having Batik draw the SVG
to that.
> I would like to work with the SVG Dom as this is nicely documented and
> standard.
Supporting transcoding from the SVG DOM would be a _huge_ amount
of work. Batik does a large amount of work to boil the DOM down to
something that can be drawn.
> Line (1) throws the following exception:
> Exception in thread "main" java.lang.NullPointerException
> at
> org.apache.batik.dom.svg.AbstractSVGLength$DefaultContext.
> getPixelUnitToMillimeter(Unknown
You need to boot the SVG and CSS DOM for the extended
SVG/CSS DOM methods to work. This is the problem in all
of your cases, see the Wiki:
http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom
> Those problems seem to be related with this sentence from the SVG spec:
> > The SVG user agent negotiates with its parent user agent to
> determine the viewport into which the SVG user agent can render the
document.
>
> The main problem seems to be that I should somehow specify a user agent,
> but I don't know how. What should I do to get this to work?
This is part of booting the SVG DOM.