Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSNumber


     */
    public long getDefaultWidth()
    {
        if (defaultWidth == 0)
        {
            COSNumber number = (COSNumber)font.getDictionaryObject( COSName.DW);
            if( number != null )
            {
                defaultWidth = number.intValue();
            }
            else
            {
                defaultWidth = 1000;
            }
View Full Code Here


            {
                int size = widths.size();
                int counter = 0;
                while (counter < size)
                {
                    COSNumber firstCode = (COSNumber)widths.getObject( counter++ );
                    COSBase next = widths.getObject( counter++ );
                    if( next instanceof COSArray )
                    {
                        COSArray array = (COSArray)next;
                        int startRange = firstCode.intValue();
                        int arraySize = array.size();
                        for (int i=0; i<arraySize; i++)
                        {
                            COSNumber width = (COSNumber)array.get(i);
                            widthCache.put(startRange+i, width.floatValue());
                        }
                    }
                    else
                    {
                        COSNumber secondCode = (COSNumber)next;
                        COSNumber rangeWidth = (COSNumber)widths.getObject( counter++ );
                        int startRange = firstCode.intValue();
                        int endRange = secondCode.intValue();
                        float width = rangeWidth.floatValue();
                        for (int i=startRange; i<=endRange; i++) {
                            widthCache.put(i,width);
                        }
                    }
                }
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

        if (inGetLength)
        {
            throw new IOException("Loop while reading length from " + lengthBaseObj);
        }

        COSNumber retVal = null;

        try
        {
            inGetLength = true;
View Full Code Here

            /*
             * This needs to be dic.getItem because when we are parsing, the
             * underlying object might still be null.
             */
            COSNumber streamLengthObj = getLength(dic.getItem(COSName.LENGTH));
            if (streamLengthObj == null)
            {
                throw new IOException("Missing length for stream.");
            }

            // ---- get output stream to copy data to
            out = stream.createFilteredStream(streamLengthObj);

            long remainBytes = streamLengthObj.longValue();
            int bytesRead = 0;
            boolean unexpectedEndOfStream = false;
            if (remainBytes == 35090)
                System.out.println();
            while (remainBytes > 0)
View Full Code Here

        if ( inGetLength )
        {
            throw new IOException( "Loop while reading length from " + lengthBaseObj );
        }
       
        COSNumber retVal = null;
       
        try
        {
            inGetLength = true;
           
View Full Code Here

            }
           
            /*This needs to be dic.getItem because when we are parsing, the underlying object
             * might still be null.
             */
            COSNumber streamLengthObj = getLength( dic.getItem( COSName.LENGTH ) );
            if ( streamLengthObj == null )
            {
                      throw new IOException( "Missing length for stream." );
            }
             
            // ---- get output stream to copy data to
            out = stream.createFilteredStream( streamLengthObj );
           
            long remainBytes = streamLengthObj.longValue();
           
            while ( remainBytes > 0 )
            {
                final int readBytes = pdfSource.read( streamCopyBuf, 0,
                        ( remainBytes > streamCopyBufLen ) ? streamCopyBufLen : (int) remainBytes );
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 rotation at this level in the hierarchy.
     */
    public Integer getRotation()
    {
        Integer retval = null;
        COSNumber value = (COSNumber)page.getDictionaryObject( COSName.ROTATE );
        if( value != null )
        {
            retval = new Integer( value.intValue() );
        }
        return retval;
    }
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

TOP

Related Classes of org.apache.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.