21

What is the smallest Java SVG engine (least/smallest jars) that actually works? If your answer is Batik, what is the minimal dep. graph for getting this to work in a simple Java application?

I've looked at the dependency graph on the Batik site, but it looks like a typical Apache mess. Are there better alternatives?

Bill
  • 12,022
  • 4
  • 34
  • 54
jsight
  • 26,474
  • 23
  • 103
  • 138

2 Answers2

17

SVG Salamander claims to be much smaller thank Batik. It's hard not to believe them. Whether it's as full featured, I can't say, but a co-worker said good things about it.

tsds
  • 7,406
  • 7
  • 57
  • 79
Dave Ray
  • 38,258
  • 7
  • 79
  • 82
  • `SVG Salamander` is a small dependency, but has rendering issues with some SVG features, namely CSS. Latest release spits this to console with an Optimized SVG from Inkscape: `Mar 17, 2016 4:24:08 PM com.kitfox.svg.xml.StyleSheet parseSheet WARNING: CSS parser not implemented yet`. Which in my testing, can result in missing color information or other rendering oddities, depending on the features used. In the testing I'm performing, it's single-color shapes, and they appear black when rendered using SVG Salamander. – tresf Mar 17 '16 at 20:27
2

Another option is JFreeSVG, the jar file is 45k only (it provides an SVGGraphics2D implementation that is not only small but also fast - see this blog post for details).

David Gilbert
  • 4,309
  • 11
  • 20
  • 2
    This answer is a bit misleading as `JFreeSVG` creates SVGs, it doesn't render them, per their forum: "Rendering SVG within a Java application is a different problem, and not one that JFreeSVG attempts to solve." http://www.jfree.org/phpBB2/viewtopic.php?f=32&t=117136 – tresf Mar 17 '16 at 14:47
  • 2
    Sure, it depends what the original poster meant by "SVG engine" - a generator or a renderer? Batik does both, JFreeSVG does generation only. – David Gilbert Mar 17 '16 at 16:08