Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSNumber


        else if( operation.equals( "d1" ) )
        {
            //set glyph with and bounding box for type 3 font
            //COSNumber horizontalWidth = (COSNumber)arguments.get( 0 );
            //COSNumber verticalWidth = (COSNumber)arguments.get( 1 );
            COSNumber llx = (COSNumber)arguments.get( 2 );
            COSNumber lly = (COSNumber)arguments.get( 3 );
            COSNumber urx = (COSNumber)arguments.get( 4 );
            COSNumber ury = (COSNumber)arguments.get( 5 );

            //width = horizontalWidth.intValue();
            //height = verticalWidth.intValue();
            box = new BoundingBox();
            box.setLowerLeftX( llx.floatValue() );
            box.setLowerLeftY( lly.floatValue() );
            box.setUpperRightX( urx.floatValue() );
            box.setUpperRightY( ury.floatValue() );
        }/*
        else if( operation.equals( "Do" ) )
        {
            //invoke named object.
        }
View Full Code Here


    public void process(PDFOperator operator, List 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 );
       
        drawer.getLinePath().lineTo( x.floatValue(), (float)drawer.fixY( x.doubleValue(), y.doubleValue()) );
    }
View Full Code Here

                long first = firstChar.intValue();
                long last = lastChar.intValue();
                if( code >= first && code <= last && font.getDictionaryObject( COSName.WIDTHS ) != null )
                {
                    COSArray widthArray = (COSArray)font.getDictionaryObject( COSName.WIDTHS );
                    COSNumber fontWidthObject = (COSNumber)widthArray.getObject( (int)(code - first) );
                    fontWidth = fontWidthObject.floatValue();
                }
                else
                {
                    fontWidth = getFontWidthFromAFMFile( code );
                }
View Full Code Here

            COSArray widths = (COSArray)font.getDictionaryObject( COSName.WIDTHS );
            if( widths != null )
            {
                for( int i=0; i<widths.size(); i++ )
                {
                    COSNumber fontWidth = (COSNumber)widths.getObject( i );
                    if( fontWidth.floatValue() > 0 )
                    {
                        totalWidth += fontWidth.floatValue();
                        characterCount += 1;
                    }
                }
            }
View Full Code Here

     * @return The page number.
     */
    public Integer getPage()
    {
        Integer retval = null;
        COSNumber page = (COSNumber)annot.getDictionaryObject( "Page" );
        if( page != null )
        {
            retval = new Integer( page.intValue() );
        }
        return retval;
    }
View Full Code Here

     * @return The default width for the glyphs in this font.
     */
    public long getDefaultWidth()
    {
        long dw = 1000;
        COSNumber number = (COSNumber)font.getDictionaryObject( COSName.getPDFName( "DW" ) );
        if( number != null )
        {
            dw = number.intValue();
        }
        return dw;
    }
View Full Code Here

            if( widths != null )
            {
                boolean foundWidth = false;
                for( int i=0; !foundWidth && i<widths.size(); i++ )
                {
                    COSNumber firstCode = (COSNumber)widths.getObject( i++ );
                    COSBase next = widths.getObject( i );
                    if( next instanceof COSArray )
                    {
                        COSArray array = (COSArray)next;
                        if( code >= firstCode.intValue() &&
                            code < firstCode.intValue() + array.size() )
                        {
                            COSNumber rangeWidth =
                                (COSNumber)array.get( code - firstCode.intValue() );
                            retval = rangeWidth.floatValue();
                            foundWidth = true;
                        }
                    }
                    else
                    {
                        COSNumber secondCode = (COSNumber)next;
                        i++;
                        COSNumber rangeWidth = (COSNumber)widths.getObject( i );
                        if( code >= firstCode.intValue() &&
                            code <= secondCode.intValue() )
                        {
                            retval = rangeWidth.floatValue();
                            foundWidth = true;
                        }
                    }
                }
                widthCache.put( new Integer( code ), new Float( retval ) );
View Full Code Here

        if( widths != null )
        {
            for( int i=0; i<widths.size(); i++ )
            {
                COSNumber firstCode = (COSNumber)widths.getObject( i++ );
                COSBase next = widths.getObject( i );
                if( next instanceof COSArray )
                {
                    COSArray array = (COSArray)next;
                    for( int j=0; j<array.size(); j++ )
                    {
                        COSNumber width = (COSNumber)array.get( j );
                        totalWidths+=width.floatValue();
                        characterCount += 1;
                    }
                }
                else
                {
                    i++;
                    COSNumber rangeWidth = (COSNumber)widths.getObject( i );
                    if( rangeWidth.floatValue() > 0 )
                    {
                        totalWidths += rangeWidth.floatValue();
                        characterCount += 1;
                    }
                }
            }
        }
View Full Code Here

     * @throws IOException If there is an error during processing.
     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
        //move text position and set leading
        COSNumber y = (COSNumber)arguments.get( 1 );
       
        ArrayList args = new ArrayList();
        args.add(new COSFloat(-1*y.floatValue()));
        context.processOperator("TL", args);
        context.processOperator("Td", arguments);

    }
View Full Code Here

     * @param operator The operator that is being executed.
     * @param arguments List
     */
    public void process(PDFOperator operator, List arguments)
    {
        COSNumber x = (COSNumber)arguments.get( 0 );
        COSNumber y = (COSNumber)arguments.get( 1 );
        Matrix td = new Matrix();
        td.setValue( 2, 0, x.floatValue() );//.* textMatrix.getValue(0,0) );
        td.setValue( 2, 1, y.floatValue() );//* textMatrix.getValue(1,1) );
        //log.debug( "textLineMatrix before " + textLineMatrix );
        context.setTextLineMatrix( td.multiply( context.getTextLineMatrix() ) ); //textLineMatrix.multiply( td );
        //log.debug( "textLineMatrix after " + textLineMatrix );
        context.setTextMatrix( context.getTextLineMatrix().copy() );
    }
View Full Code Here

TOP

Related Classes of org.pdfbox.cos.COSNumber

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.