Module platform

Class ExportUtils

java.lang.Object
org.jfree.chart.util.ExportUtils

public class ExportUtils extends Object
Utility functions for exporting charts to SVG and PDF format.
  • Constructor Details

    • ExportUtils

      public ExportUtils()
  • Method Details

    • isJFreeSVGAvailable

      public static boolean isJFreeSVGAvailable()
      Returns true if JFreeSVG is on the classpath, and false otherwise. The JFreeSVG library can be found at http://www.jfree.org/jfreesvg/
      Returns:
      A boolean.
    • isOrsonPDFAvailable

      public static boolean isOrsonPDFAvailable()
      Returns true if OrsonPDF (or JFreePDF) is on the classpath, and false otherwise. The OrsonPDF library can be found at https://github.com/jfree/orsonpdf. JFreePDF is a modular version of the same library, requiring Java 11 or later. Since JFreeChart might be used in a modular context, this function has been modified (in version 1.5.3) to detect JFreePDF also.
      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 (null not permitted).
      w - the chart width.
      h - the chart height.
      file - the output file (null not permitted).
    • writeAsPDF

      public static final void writeAsPDF(Drawable drawable, int w, int h, File file)
      Writes a Drawable to 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 (null not permitted).
      w - the chart width.
      h - the chart height.
      file - the output file (null not 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 (null not permitted).
      w - the chart width.
      h - the chart height.
      file - the output file (null not 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 (null not permitted).
      w - the chart width.
      h - the chart height.
      file - the output file (null not permitted).
      Throws:
      FileNotFoundException - if the file is not found.
      IOException - if there is an I/O problem.