Package org.apache.pdfbox.pdfviewer

Examples of org.apache.pdfbox.pdfviewer.PageDrawer


        }
        colorInstance.setColorSpaceValue( values );

        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(false);
        }
    }
View Full Code Here


        }
        color.setColorSpaceValue( values );
       
        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(true);
        }
    }
View Full Code Here

        }
        color.setColorSpaceValue( values );

        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(true);
        }
    }
View Full Code Here

     * @param operator The operator that is being executed.
     * @param arguments List
     */
    public void process(PDFOperator operator, List arguments)
    {
        PageDrawer drawer = (PageDrawer)context;

        COSNumber x = (COSNumber)arguments.get( 0 );
        COSNumber y = (COSNumber)arguments.get( 1 );
        COSNumber w = (COSNumber)arguments.get( 2 );
        COSNumber h = (COSNumber)arguments.get( 3 );

        double x1 = x.floatValue();
        double y1 = y.floatValue();
        // create a pair of coordinates for the transformation
        double x2 = w.floatValue()+x1;
        double y2 = h.floatValue()+y1;

        Point2D startCoords = drawer.transformedPoint(x1,y1);
        Point2D endCoords = drawer.transformedPoint(x2,y2);

        double width = endCoords.getX()-startCoords.getX();
        double height =  endCoords.getY()-startCoords.getY();
        double xStart = startCoords.getX();
        double yStart = startCoords.getY();
        // we have to calculate the width and height from the two pairs of coordinates
        // if the endCoords are above the startCoords we have to switch them
        if (width < 0)
        {
            xStart += width;
            width = -width;
        }
        if (height < 0)
        {
            yStart += height;
            height = -height;
        }
        Rectangle2D rect = new Rectangle2D.Double(xStart, yStart, width, height);
        drawer.getLinePath().append( rect, false );
    }
View Full Code Here

    public void process(PDFOperator operator, List arguments) throws IOException
    {
        ///dwilson 3/19/07 refactor
        try
        {
            PageDrawer drawer = (PageDrawer)context;
   
            float lineWidth = (float)context.getGraphicsState().getLineWidth();
            Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix();
            if ( ctm != null && ctm.getXScale() > 0)
            {
                lineWidth = lineWidth * ctm.getXScale();
            }
            Graphics2D graphics = ((PageDrawer)context).getGraphics();
            BasicStroke stroke = (BasicStroke)graphics.getStroke();
            if (stroke == null)
            {
                graphics.setStroke( new BasicStroke( lineWidth ) );
            }
            else
            {
                graphics.setStroke( new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(),
                        stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
            }
            drawer.strokePath();
        }
        catch (Exception exception)
        {
            log.warn(exception, exception);
        }
View Full Code Here

     * @param operator The operator that is being executed.
     * @param arguments List
     */
    public void process(PDFOperator operator, List arguments)
    {
        PageDrawer drawer = (PageDrawer)context;

        COSNumber x1 = (COSNumber)arguments.get( 0 );
        COSNumber y1 = (COSNumber)arguments.get( 1 );
        COSNumber x3 = (COSNumber)arguments.get( 2 );
        COSNumber y3 = (COSNumber)arguments.get( 3 );

        Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue());
        Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue());

        drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(),
                (float)point3.getX(), (float)point3.getY(), (float)point3.getX(), (float)point3.getY());
    }
View Full Code Here

     * @param arguments List
     * @throws IOException If there is an error displaying the inline image.
     */
    public void process(PDFOperator operator, List argumentsthrows IOException
    {
        PageDrawer drawer = (PageDrawer)context;
        PDPage page = drawer.getPage();
        Dimension pageSize = drawer.getPageSize();
        Graphics2D graphics = drawer.getGraphics();
        //begin inline image object
        ImageParameters params = operator.getImageParameters();
        PDInlinedImage image = new PDInlinedImage();
        image.setImageParameters( params );
        image.setImageData( operator.getImageData() );
        BufferedImage awtImage = image.createImage( context.getColorSpaces() );

        if (awtImage == null)
        {
            log.warn("BeginInlineImage.process(): createImage returned NULL");
            return;
        }
        int imageWidth = awtImage.getWidth();
        int imageHeight = awtImage.getHeight();
        double pageHeight = pageSize.getHeight();
       
        Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix();
        int pageRotation = page.findRotation();

        AffineTransform ctmAT = ctm.createAffineTransform();
        ctmAT.scale(1f/imageWidth, 1f/imageHeight);
        Matrix rotationMatrix = new Matrix();
View Full Code Here

    public void process(PDFOperator operator, List arguments) throws IOException
    {
        try
        {
            ///dwilson refactoring
            PageDrawer drawer = (PageDrawer)context;
            drawer.fillPath(GeneralPath.WIND_EVEN_ODD);
        }
        catch (Exception e)
        {
            log.warn(e, e);
        }
View Full Code Here

     * @param operator The operator that is being executed.
     * @param arguments List
     */
    public void process(PDFOperator operator, List arguments)
    {
        PageDrawer drawer = (PageDrawer)context;

        COSNumber x1 = (COSNumber)arguments.get( 0 );
        COSNumber y1 = (COSNumber)arguments.get( 1 );
        COSNumber x2 = (COSNumber)arguments.get( 2 );
        COSNumber y2 = (COSNumber)arguments.get( 3 );
        COSNumber x3 = (COSNumber)arguments.get( 4 );
        COSNumber y3 = (COSNumber)arguments.get( 5 );

        Point2D point1 = drawer.transformedPoint(x1.doubleValue(), y1.doubleValue());
        Point2D point2 = drawer.transformedPoint(x2.doubleValue(), y2.doubleValue());
        Point2D point3 = drawer.transformedPoint(x3.doubleValue(), y3.doubleValue());

        drawer.getLinePath().curveTo((float)point1.getX(), (float)point1.getY(),
                (float)point2.getX(), (float)point2.getY(), (float)point3.getX(), (float)point3.getY());
    }
View Full Code Here

        }
        colorInstance.setColorSpaceValue( values );
       
        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(true);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdfviewer.PageDrawer

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.