Package org.apache.fop.svg

Examples of org.apache.fop.svg.PDFGraphics2D


        // and positive is down and to the right. (0,0) is where the
        // viewBox puts it.
        generator.add(sx + " 0 0 " + sy + " " + fx + " " + fy + " cm\n");

        final boolean textAsShapes = false;
        PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes,
                pdfContext.getFontInfo(), generator.getDocument(),
                generator.getResourceContext(), pdfContext.getPage().referencePDF(),
                "", 0.0f);
        graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());

        AffineTransform transform = new AffineTransform();
        transform.translate(fx, fy);
        generator.getState().concatenate(transform);
        graphics.setPaintingState(generator.getState());
        graphics.setOutputStream(generator.getOutputStream());

        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
        imageG2D.getGraphics2DImagePainter().paint(graphics, area);

        generator.add(graphics.getString());
        if (accessibilityEnabled) {
            generator.restoreGraphicsStateAccess();
        } else {
            generator.restoreGraphicsState();
        }
View Full Code Here


        renderer.currentStream.add(sx + " 0 0 " + sy + " " + fx + " "
                          + fy + " cm\n");


        final boolean textAsShapes = false;
        PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes,
                pdfInfo.fi, pdfInfo.pdfDoc,
                pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
                renderer.currentFontName,
                renderer.currentFontSize);
        graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
       
        AffineTransform transform = new AffineTransform();
        transform.translate(fx, fy);
        pdfInfo.pdfState.setTransform(transform);
        graphics.setPDFState(pdfInfo.pdfState);
        graphics.setOutputStream(pdfInfo.outputStream);

        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
        painter.paint(graphics, area);

        pdfInfo.currentStream.add(graphics.getString());
        renderer.restoreGraphicsState();
        pdfInfo.pdfState.pop();
   
    }
View Full Code Here

        }*/

        if (pdfInfo.pdfContext == null) {
            pdfInfo.pdfContext = pdfInfo.pdfPage;
        }
        PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi,
                pdfInfo.pdfDoc,
                pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
                pdfInfo.currentFontName, pdfInfo.currentFontSize);
        graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
        pdfInfo.pdfState.push();
        AffineTransform transform = new AffineTransform();
        // scale to viewbox
        transform.translate(xOffset / 1000f, yOffset / 1000f);

        if (deviceResolution != uaResolution) {
            //Scale for higher resolution on-the-fly images from Batik
            double s = uaResolution / deviceResolution;
            at.scale(s, s);
            pdfInfo.currentStream.add("" + PDFNumber.doubleOut(s) + " 0 0 "
                                + PDFNumber.doubleOut(s) + " 0 0 cm\n");
            graphics.scale(1 / s, 1 / s);
        }

        pdfInfo.pdfState.setTransform(transform);
        graphics.setPDFState(pdfInfo.pdfState);
        graphics.setOutputStream(pdfInfo.outputStream);
        try {
            root.paint(graphics);
            pdfInfo.currentStream.add(graphics.getString());
        } catch (Exception e) {
            log.error("svg graphic could not be rendered: "
                                   + e.getMessage(), e);
        }

View Full Code Here

        }*/

        if (pdfInfo.pdfContext == null) {
            pdfInfo.pdfContext = pdfInfo.pdfPage;
        }
        PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi,
                pdfInfo.pdfDoc,
                pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
                pdfInfo.currentFontName, pdfInfo.currentFontSize);
        graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
        pdfInfo.pdfState.push();
        AffineTransform transform = new AffineTransform();
        // scale to viewbox
        transform.translate(xOffset / 1000f, yOffset / 1000f);

        if (deviceResolution != uaResolution) {
            //Scale for higher resolution on-the-fly images from Batik
            double s = uaResolution / deviceResolution;
            at.scale(s, s);
            pdfInfo.currentStream.add("" + PDFNumber.doubleOut(s) + " 0 0 "
                                + PDFNumber.doubleOut(s) + " 0 0 cm\n");
            graphics.scale(1 / s, 1 / s);
        }

        pdfInfo.pdfState.setTransform(transform);
        graphics.setPDFState(pdfInfo.pdfState);
        graphics.setOutputStream(pdfInfo.outputStream);
        try {
            root.paint(graphics);
            pdfInfo.currentStream.add(graphics.getString());
        } catch (Exception e) {
            log.error("svg graphic could not be rendered: "
                                   + e.getMessage(), e);
        }

View Full Code Here

            }

            if (pdfInfo.pdfContext == null) {
                pdfInfo.pdfContext = pdfInfo.pdfPage;
            }
            PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi, pdfInfo.pdfDoc,
                                     pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
                                     pdfInfo.currentFontName,
                                     pdfInfo.currentFontSize);
            graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
            pdfInfo.pdfState.push();
            AffineTransform transform = new AffineTransform();
            // scale to viewbox
            transform.translate(xOffset / 1000f, yOffset / 1000f);

            if (deviceResolution != uaResolution) {
                //Scale for higher resolution on-the-fly images from Batik
                double s = uaResolution / deviceResolution;
                at.scale(s, s);
                pdfInfo.currentStream.add("" + PDFNumber.doubleOut(s) + " 0 0 "
                                    + PDFNumber.doubleOut(s) + " 0 0 cm\n");
                graphics.scale(1 / s, 1 / s);
            }

            pdfInfo.pdfState.setTransform(transform);
            graphics.setPDFState(pdfInfo.pdfState);
            graphics.setOutputStream(pdfInfo.outputStream);
            try {
                root.paint(graphics);
                pdfInfo.currentStream.add(graphics.getString());
            } catch (Exception e) {
                log.error("svg graphic could not be rendered: "
                                       + e.getMessage(), e);
            }
View Full Code Here

        renderer.currentStream.add(sx + " 0 0 " + sy + " " + fx + " "
                          + fy + " cm\n");


        final boolean textAsShapes = false;
        PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes,
                pdfInfo.fi, pdfInfo.pdfDoc,
                pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
                renderer.currentFontName,
                renderer.currentFontSize);
        graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
       
        AffineTransform transform = new AffineTransform();
        transform.translate(fx, fy);
        pdfInfo.pdfState.setTransform(transform);
        graphics.setPDFState(pdfInfo.pdfState);
        graphics.setOutputStream(pdfInfo.outputStream);

        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
        painter.paint(graphics, area);

        pdfInfo.currentStream.add(graphics.getString());
        renderer.restoreGraphicsState();
        pdfInfo.pdfState.pop();
   
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.svg.PDFGraphics2D

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.