Package org.apache.pdfbox.pdfviewer

Examples of org.apache.pdfbox.pdfviewer.PageDrawer


     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        super.process( operator, arguments );
        int lineJoinStyle = context.getGraphicsState().getLineJoin();
        PageDrawer drawer = (PageDrawer)context;
        BasicStroke stroke = (BasicStroke)drawer.getStroke();
        if (stroke == null)
        {
            drawer.setStroke( new BasicStroke(1,BasicStroke.CAP_SQUARE,lineJoinStyle) );
        }
        else
        {
            drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), lineJoinStyle,
                    stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
        }
    }
View Full Code Here


     *
     * @throws IOException if something went wrong during logging
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PageDrawer drawer = (PageDrawer)context;
        try
        {
            drawer.getLinePath().closePath();
        }
        catch( Throwable t )
        {
            log.warn(t, t);
        }
View Full Code Here

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

        //append straight line segment from the current point to the point.
        COSNumber x = (COSNumber)arguments.get( 0 );
        COSNumber y = (COSNumber)arguments.get( 1 );

        Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue());
        drawer.getLinePath().lineTo((float)pos.getX(), (float)pos.getY());
    }
View Full Code Here

        float lineWidth = (float)context.getGraphicsState().getLineWidth();
        if (lineWidth == 0)
        {
            lineWidth = 1;
        }
        PageDrawer drawer = (PageDrawer)context;
        BasicStroke stroke = (BasicStroke)drawer.getStroke();
        if (stroke == null)
        {
            drawer.setStroke( new BasicStroke( lineWidth ) );
        }
        else
        {
            drawer.setStroke( new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(),
                    stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()) );
        }
    }
View Full Code Here

     * @param operator The operator that is being executed.
     * @param arguments List
     */
    public void process(PDFOperator operator, List<COSBase> 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.doubleValue();
        double y1 = y.doubleValue();
        // create a pair of coordinates for the transformation
        double x2 = w.doubleValue()+x1;
        double y2 = h.doubleValue()+y1;

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

        float width = (float)(endCoords.getX()-startCoords.getX());
        float height = (float)(endCoords.getY()-startCoords.getY());
        float xStart = (float)startCoords.getX();
        float yStart = (float)startCoords.getY();

        // To ensure that the path is created in the right direction,
        // we have to create it by combining single lines instead of
        // creating a simple rectangle
        GeneralPath path = drawer.getLinePath();
        path.moveTo(xStart, yStart);
        path.lineTo(xStart+width, yStart);
        path.lineTo(xStart+width, yStart+height);
        path.lineTo(xStart, yStart+height);
        path.lineTo(xStart, yStart);
View Full Code Here

    public void process(PDFOperator operator, List<COSBase> 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();
            }
           
            BasicStroke stroke = (BasicStroke)drawer.getStroke();
            if (stroke == null)
            {
                drawer.setStroke( new BasicStroke( lineWidth ) );
            }
            else
            {
                drawer.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<COSBase> 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

     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        super.process( operator, arguments );
        int lineCapStyle = context.getGraphicsState().getLineCap();
        PageDrawer drawer = (PageDrawer)context;
        BasicStroke stroke = (BasicStroke)drawer.getStroke();
        if (stroke == null)
        {
            drawer.setStroke( new BasicStroke(1,lineCapStyle,BasicStroke.JOIN_MITER) );
        }
        else
        {
            drawer.setStroke( new BasicStroke(stroke.getLineWidth(), lineCapStyle, stroke.getLineJoin(),
                    stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()));
        }
    }
View Full Code Here

        }
        colorInstance.setColorSpaceValue( values );

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

            throw new IOException( "Error: Expected at least one argument when setting non stroking gray color");
        }
        color.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.