Package org.apache.batik.svggen

Examples of org.apache.batik.svggen.SVGGraphics2D.stream()


                                          ".svg");
           
            OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");

            painter.paint(g2d);
            g2d.stream(osw);
            osw.flush();
        }catch(Exception e){
            e.printStackTrace();
            throw new IllegalArgumentException
                (Messages.formatMessage(ERROR_COULD_NOT_TRANSCODE_TO_SVG,
View Full Code Here


        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8");
        try{
            painter.paint(g2d);
            configureSVGGraphics2D(g2d);
            g2d.stream(osw);
            osw.flush();
            bos.flush();
            bos.close();
        }catch(Exception e){
            StringWriter trace = new StringWriter();
View Full Code Here

        log.debug("working_dir: " + uploadTempDir);
        String reqFilePrefix = fileName + "_" + CalendarPatterns.getTimeForStreamId(new Date());
        File svgFile = new File(uploadTempDir, reqFilePrefix + ".svg");
        log.debug("exported svg file: " + svgFile.getCanonicalPath());
        FileWriter out = new FileWriter(svgFile);
        svgGenerator.stream(out, useCSS);
        out.flush();
        out.close();
        File expFile = new File(uploadTempDir, reqFilePrefix + "." + exportType);
        log.debug("exported file: " + expFile.getCanonicalPath());
        if ("svg".equals(exportType)) {
View Full Code Here

      //httpServletResponse.setHeader("Content-Disposition","attachment; filename=\"" + requestedFile + "\"");
          Writer out = new OutputStreamWriter(System.out, "UTF-8");

          //StringWriter out = new StringWriter();
         
          svgGenerator.stream(out, useCSS);
    } catch (Exception er) {
      log.error("ERROR ", er);
      System.out.println("Error exporting: " + er);
      er.printStackTrace();
    }
View Full Code Here

        log.debug("working_dir: " + uploadTempDir);
        String reqFilePrefix = fileName + "_" + CalendarPatterns.getTimeForStreamId(new Date());
        File svgFile = new File(uploadTempDir, reqFilePrefix + ".svg");
        log.debug("exported svg file: " + svgFile.getCanonicalPath());
        FileWriter out = new FileWriter(svgFile);
        svgGenerator.stream(out, useCSS);
        out.flush();
        out.close();
        File expFile = new File(uploadTempDir, reqFilePrefix + "." + exportType);
        log.debug("exported file: " + expFile.getCanonicalPath());
        if ("svg".equals(exportType)) {
View Full Code Here

      Controller.getCurrentController().getViewController().setWaitingCursor(true);
      final SVGGraphics2D g2d = fillSVGGraphics2D(view);
      final FileOutputStream bos = new FileOutputStream(chosenFile);
      final BufferedOutputStream bufStream = new BufferedOutputStream(bos);
      final OutputStreamWriter osw = new OutputStreamWriter(bufStream, "UTF-8");
      g2d.stream(osw);
      osw.flush();
      bos.flush();
      bos.close();
    }
    catch (final Exception ex) {
View Full Code Here

          chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, 600,
              400), null);
          try {
            Writer out = new OutputStreamWriter(
                new FileOutputStream(file), "UTF-8");
            svgGenerator.stream(out, true);
          } catch (UnsupportedEncodingException e1) {
            JOptionPane.showMessageDialog(this,
                "Unsupported Encoding", "Error",
                JOptionPane.ERROR_MESSAGE);
          } catch (FileNotFoundException e1) {
View Full Code Here

        //
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(bos, "UTF-8");
        try{
            painter.paint(g2d);
            g2d.stream(osw);
            osw.flush();
            bos.flush();
            bos.close();
        }catch(Exception e){
            StringWriter trace = new StringWriter();
View Full Code Here

    SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
    ctx.setComment("Generated by Cewolf using JFreeChart and Apache Batik SVG Generator");
    SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
    svgGenerator.setSVGCanvasSize(new Dimension(width, height));
    chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, width, height), null);
    svgGenerator.stream(writer, false);
    writer.close();
  }

  //gets first legend in the list
  public static LegendTitle getLegend(JFreeChart chart)
View Full Code Here

    // Finally, stream out SVG to a file using UTF-8 character to byte
    // encoding
    boolean useCSS = true;
    Writer out =
        new OutputStreamWriter( new FileOutputStream( new File( path + ".svg" ) ), LocaleHelper.getSystemEncoding() ); //$NON-NLS-1$
    svgGenerator.stream( out, useCSS );
  }

  /**
   * Create an image file from a JFreeChart object
   *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.