Package org.apache.batik.svggen

Examples of org.apache.batik.svggen.SVGGeneratorContext


        // Create an instance of org.w3c.dom.Document
        this.document = domImpl.createDocument(null, "svg", null);

        // Create an SVGGeneratorContext to customize SVG generation
        SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(this.document);
        ctx.setComment("Generated by " + userAgent.getProducer() + " with Batik SVG Generator");
        ctx.setEmbeddedFontsOn(true);
       
        // Create an instance of the SVG Generator
        this.svgGenerator = new SVGGraphics2D(ctx, true);
        Rectangle2D viewArea = pageViewport.getViewArea();
        Dimension dim = new Dimension();
View Full Code Here


    try
    {
      final DOMImplementation impl = GenericDOMImplementation.getDOMImplementation();
      final String namespaceURI = SVGConstants.SVG_NAMESPACE_URI;
      final Document domFactory = impl.createDocument(namespaceURI, "svg", null);
      final SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(domFactory);
      ctx.setEmbeddedFontsOn(true);
      final GraphicContextDefaults defaults = new GraphicContextDefaults();
      defaults.setFont(new Font("Arial", Font.PLAIN, 12));
      ctx.setGraphicContextDefaults(defaults);
      ctx.setPrecision(12);
      final SVGGraphics2D g2d = new SVGGraphics2D(ctx, false);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
      view.preparePrinting();
      final Rectangle innerBounds = view.getInnerBounds();
View Full Code Here

        // Create an instance of org.w3c.dom.Document
        this.document = domImpl.createDocument(null, "svg", null);

        // Create an SVGGeneratorContext to customize SVG generation
        SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(this.document);
        ctx.setComment("Generated by " + userAgent.getProducer() + " with Batik SVG Generator");
        ctx.setEmbeddedFontsOn(true);

        // Create an instance of the SVG Generator
        this.svgGenerator = new SVGGraphics2D(ctx, true);
        Rectangle2D viewArea = pageViewport.getViewArea();
        Dimension dim = new Dimension();
View Full Code Here

        // Create an instance of org.w3c.dom.Document
        this.document = domImpl.createDocument(null, "svg", null);

        // Create an SVGGeneratorContext to customize SVG generation
        SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(this.document);
        ctx.setComment("Generated by " + userAgent.getProducer() + " with Batik SVG Generator");
        ctx.setEmbeddedFontsOn(true);

        // Create an instance of the SVG Generator
        this.svgGenerator = new SVGGraphics2D(ctx, true);
        Rectangle2D viewArea = pageViewport.getViewArea();
        Dimension dim = new Dimension();
View Full Code Here

  private static synchronized void handleSVG(ByteArrayOutputStream baos, JFreeChart chart, int width, int height)
    throws IOException {
    OutputStreamWriter writer = new OutputStreamWriter(baos, "UTF-8");
    DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
    Document document = domImpl.createDocument("cewolf-svg", "svg", null);
    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();
View Full Code Here

        Document document = domImpl.createDocument(
                SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);
        Element root = document.getDocumentElement();

        // Create an SVGGeneratorContext to customize SVG generation
        SVGGeneratorContext genCtx = SVGGeneratorContext.createDefault(document);
        genCtx.setComment("Generated by Apache Batik's SVGGraphics2D");
        genCtx.setEmbeddedFontsOn(true);

        // Create an instance of the SVG Generator
        SVGGraphics2D g2d = new SVGGraphics2D(genCtx, true);
        ImageSize size = src.getSize();
        Dimension dim = size.getDimensionMpt();
View Full Code Here

            throws ParserConfigurationException {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document document = db.getDOMImplementation().createDocument(null, "svg", null);

        SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
        ctx.setStyleHandler(new OpacityAdjustingStyleHandler());
        ctx.setComment("Generated by GeoTools2 with Batik SVG Generator");

        SVGGraphics2D g2d = new SVGGraphics2D(ctx, true);
        g2d.setSVGCanvasSize(size);

        return g2d;
View Full Code Here

     * @throws GraphicException For error obtaining a new SVGDocument instance.
     */
    private SVGGraphics2D createSVGGenerator(final MathBase mathBase)
            throws GraphicException {
        final SVGDocument svgDocument = this.makeSvgDocument();
        final SVGGeneratorContext svgContext = SVGGeneratorContext
                .createDefault(svgDocument);
        svgContext.setComment("Converted from MathML using JEuclid");
        final SVGGraphics2D svgGenerator = new SVGGraphics2D(svgContext, true);

        final Dimension size = new Dimension((int) Math.ceil(mathBase
                .getWidth(svgGenerator)), (int) Math.ceil(mathBase
                .getHeight(svgGenerator)));
View Full Code Here

   
    // Create an instance of org.w3c.dom.Document
    document = db.getDOMImplementation().createDocument(null, "svg", null);
   
    // Set up the map
    SVGGeneratorContext ctx1 = SVGGeneratorContext.createDefault(document);
    SVGGeneratorContext ctx = ctx1;
    ctx.setComment("Generated by GeoTools2 with Batik SVG Generator");
   
    SVGGraphics2D g2d = new SVGGraphics2D(ctx, true);
   
    g2d.setSVGCanvasSize(canvasSize);
   
View Full Code Here

            if ((height == -1) || (width == -1)) {
                throw new IOException("Could not determine map dimensions");
            }

            SVGGeneratorContext context = setupContext();
            SVGGraphics2D g = new SVGGraphics2D(context, true);

            g.setSVGCanvasSize(new Dimension((int) width, (int) height));

            // turn off/on anti aliasing
View Full Code Here

TOP

Related Classes of org.apache.batik.svggen.SVGGeneratorContext

Copyright © 2018 www.massapicom. 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.