Hi, On Feb 1, 2008 11:07 PM, David Delbecq <[EMAIL PROTECTED]> wrote: > Hello, > > Am trying to use transcoder API to convert an existing SVG to a PNG. I > followed docs here: > http://xmlgraphics.apache.org/batik/using/transcoder.html and looked at > sources of Rasterizer tool, but am lost at several points. I have > several requirements for which i can't seem to easily locate solution in > docs: > > 1st: size of svg is not known by code, it should be discovered by > looking at SVG file ("natural" size of svg, if that makes sense). > However, rasterizer requires me to specify a size that is equal or > bigger than svg size if i want to see everything. Otherwise it's > truncated. Is there a way to have transcoder use the svg size, instead > of being force to provide one?
I think it is depend on your svg content, if all of your width/height attribute is specified as "%" percent, then there is no way to know the size of svg, unless you are using absolute lenght eg: px, etc. One workaround is to use viewbox or width and height attribute in the outer svg element. By default If I am not wrong Batik will use 400x400 when the size is not specified or unknown unless overidden. > 2nd: I need to add a css to that svg. I see rasterizer is able to do it. > However, it uses map.put(ImageTranscoder.KEY_USER_STYLESHEET_URI, > userStylesheetURL); That mean i have to put my css in a file prior to > use it. The css being generated on the fly (the main reason why we need > to transcode svg to png at every request), i have it inside a > java.lang.String. Is there a way to provide that css string to > transcoder directly? Without ressorting to a uri? I haven't tried yet, but maybe you could open the svg document (it is just xml file) and insert your generated css into that document then transcode Cheers Tonny Kohar -- Sketsa SVG Editor imagine, design, create ... http://www.kiyut.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
