- java.lang.Object
-
- org.jfree.chart.util.ExportUtils
-
public class ExportUtils extends Object
Utility functions for exporting charts to SVG and PDF format.
-
-
Constructor Summary
Constructors Constructor Description ExportUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisJFreeSVGAvailable()Returnstrueif JFreeSVG is on the classpath, andfalseotherwise.static booleanisOrsonPDFAvailable()Returnstrueif OrsonPDF is on the classpath, andfalseotherwise.static voidwriteAsJPEG(Drawable drawable, int w, int h, File file)Writes the current content to the specified file in JPEG format.static voidwriteAsPDF(Drawable drawable, int w, int h, File file)Writes aDrawableto the specified file in PDF format.static voidwriteAsPNG(Drawable drawable, int w, int h, File file)Writes the current content to the specified file in PNG format.static voidwriteAsSVG(Drawable drawable, int w, int h, File file)Writes the current content to the specified file in SVG format.
-
-
-
Constructor Detail
-
ExportUtils
public ExportUtils()
-
-
Method Detail
-
isJFreeSVGAvailable
public static boolean isJFreeSVGAvailable()
Returnstrueif JFreeSVG is on the classpath, andfalseotherwise. The JFreeSVG library can be found at http://www.jfree.org/jfreesvg/- Returns:
- A boolean.
-
isOrsonPDFAvailable
public static boolean isOrsonPDFAvailable()
Returnstrueif OrsonPDF is on the classpath, andfalseotherwise. The OrsonPDF library can be found at http://www.object-refinery.com/orsonpdf/- Returns:
- A boolean.
-
writeAsSVG
public static void writeAsSVG(Drawable drawable, int w, int h, File file)
Writes the current content to the specified file in SVG format. This will only work when the JFreeSVG library is found on the classpath. Reflection is used to ensure there is no compile-time dependency on JFreeSVG.- Parameters:
drawable- the drawable (nullnot permitted).w- the chart width.h- the chart height.file- the output file (nullnot permitted).
-
writeAsPDF
public static final void writeAsPDF(Drawable drawable, int w, int h, File file)
Writes aDrawableto the specified file in PDF format. This will only work when the OrsonPDF library is found on the classpath. Reflection is used to ensure there is no compile-time dependency on OrsonPDF.- Parameters:
drawable- the drawable (nullnot permitted).w- the chart width.h- the chart height.file- the output file (nullnot permitted).
-
writeAsPNG
public static void writeAsPNG(Drawable drawable, int w, int h, File file) throws FileNotFoundException, IOException
Writes the current content to the specified file in PNG format.- Parameters:
drawable- the drawable (nullnot permitted).w- the chart width.h- the chart height.file- the output file (nullnot permitted).- Throws:
FileNotFoundException- if the file is not found.IOException- if there is an I/O problem.
-
writeAsJPEG
public static void writeAsJPEG(Drawable drawable, int w, int h, File file) throws FileNotFoundException, IOException
Writes the current content to the specified file in JPEG format.- Parameters:
drawable- the drawable (nullnot permitted).w- the chart width.h- the chart height.file- the output file (nullnot permitted).- Throws:
FileNotFoundException- if the file is not found.IOException- if there is an I/O problem.
-
-