Version 4.1, by David Gilbert, 26 March 2020.
(C)opyright 2013-2020, by Object Refinery Limited. All rights reserved.
JFreeSVG is a graphics library for the Java(tm) platform that allows you to generate content in SVG format using the standard Java2D drawing API (
Graphics2D). JFreeSVG is light-weight, fast, and has no dependencies other than the Java runtime (11 or later).
The home page for the project is:
The Javadocs for the
SVGGraphics2D class gives examples for typical usage, and if you are already familiar with the Java2D APIs, then all you need to do is add the JFreeSVG dependency and start coding.
Oracle provides tutorials for Java2D here:
There are some demonstration applications in the JFree-Demos project at GitHub.
JFreeSVG is published to the Central Repository. You can include it in your projects with the following dependency:
<dependency> <groupId>org.jfree</groupId> <artifactId>org.jfree.svg</artifactId> <version>4.1</version> </dependency>
JFreeSVG is a modular library with the module name
To use JFreeSVG with Java 8, you can use the following (note the different artifact ID):
<dependency> <groupId>org.jfree</groupId> <artifactId>jfreesvg</artifactId> <version>3.4</version> </dependency>
You can build
JFreeSVG from sources using Maven:
mvn clean install
JFreeSVG is free software under the terms of the GNU General Public License version 3 (GPLv3) or later. The license file is included in this distribution (gpl-3.0.txt). If you prefer not to be bound by the terms of the GPLv3, you can purchase an alternative license from Object Refinery Limited (please e-mail [email protected]inery.com for details, or check the JFreeSVG home page).
Please note that JFreeSVG is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer to the license for details.
Version 4.2 (not yet released)
Version 4.1 (26 March 2020)
Version 4.0 (27 February 2020)
fillArc()methods to draw pie arcs;
Version 3.4 (10 February 2019)
drawString()method for empty string;
Version 3.3 (7 November 2017)
DEFSkey prefix should not begin with a number;
Version 3.2 (9 October 2016)
heightfrom SVG element;
viewBoxand associated parameters in the SVG element;
drawImage(Image, AffineTransform, ImageObserver)(bug #6);
create()method (bug #5).
Version 3.1 (30 April 2016)
ellipseelement to draw/fill
Version 3.0 (8 June 2015)
BasicStrokecap, join and miterlimit;
ClassCastExceptionwhen exporting Swing UIs on MacOSX with Nimbus L&F.
Version 2.1 (4 August 2014)
Version 2.0 (30 July 2014)
create()method so that Swing components can be rendered correctly;
rgba(), and write the alpha value to separate opacity attribute;
Version 1.9 (6 May 2014)
defsKeyPrefixattribute to allow unique ids for DEFS when generating multiple SVG elements for use in a single HTML page;
LinearGradientPaintand improved existing
zeroStrokeWidthattribute to allow configuration of handling for
BasicStrokewith zero width (which the Java specification states should be "rendered as the thinnest possible line");
drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)method.
Version 1.8 (11 April 2014)
KEY_BEGIN_GROUPoptions, plus special integration support for Orson Charts;
Strokeis not an instance of
Version 1.7 (25 February 2014)
SVGHints.KEY_END_GROUPto allow grouping of SVG output;
drawString()to include id if
Version 1.6 (18 December 2013)
Version 1.5 (18 December 2013)
FontMapperto ensure that Java logical font names map to the equivalent SVG generic font names;
SVGHints.KEY_IMAGE_HREFto allow image references to be specified;
SVGHints.KEY_ELEMENT_IDto allow an element id to be supplied for the next element to be written;
Version 1.4 (24 October 2013)
getSVGFontStyle()now specifies font-size units as required by the SVG standard. Fixes a bug that is visible when the SVG output is rendered in FireFox (which is more strict about the standard than other browsers);
SVGHintto configure the value of the text-rendering attribute.
Version 1.3 (24 September 2013)
preserveAspectRatioattribute for images;
Version 1.2 (13 September 2013)
linearGradientelement, to pass W3C validator;
Version 1.1 (4 September 2013)
drawString(AttributedCharacterIterator, float, float)using
drawGlyphVector()to fill rather than stroke shapes (for
CanvasGraphics2Dto control number of decimal places for numbers written to script;
Version 1.0 (31 July 2013)
If you have any questions or feedback about JFreeSVG, please post in the forum:
...or send an e-mail to [email protected]