Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSInteger


            {
                PDPageNode node = (PDPageNode)next;
                totalCount += node.updateCount();
            }
        }
        page.setItem( COSName.COUNT, new COSInteger( totalCount ) );
        return totalCount;
    }
View Full Code Here


     *
     * @param rotation The new rotation for this page.
     */
    public void setRotation( int rotation )
    {
        page.setItem( COSName.getPDFName( "Rotate" ), new COSInteger( rotation ) );
    }
View Full Code Here

        // add new page to kids entry in the pages dictionary
        COSArray kids = (COSArray) pages.getItem(COSName.getPDFName("Kids"));
        kids.add(destination.createObject(page));
        // and increase count
        COSNumber count = (COSNumber) pages.getItem(COSName.COUNT);
        pages.setItem(COSName.COUNT, new COSInteger(count.intValue() + 1));
    }
View Full Code Here

        while( ((i = pdfSource.peek()) > 0) && ((char)i != ']') )
        {
            pbo = parseDirObject();
            if( pbo instanceof COSObject )
            {
                COSInteger genNumber = (COSInteger)po.remove( po.size() -1 );
                COSInteger number = (COSInteger)po.remove( po.size() -1 );
                COSObjectKey key = new COSObjectKey(number.intValue(), genNumber.intValue());
                pbo = getObjectFromPool(key);
            }
            //System.out.println( "parseCOSArray() adding " + pbo );
            if( pbo != null )
            {
View Full Code Here

     * @return flags The set of flags.
     */
    public int getFlags()
    {
        int retval = 0;
        COSInteger ff = (COSInteger)getDictionary().getDictionaryObject( COSName.getPDFName( "Ff" ) );
        if( ff != null )
        {
            retval = (int)ff.intValue();
        }
        return retval;
    }
View Full Code Here

     *
     * @param flags The new flags.
     */
    public void setFlags( int flags )
    {
        COSInteger ff = new COSInteger( flags );
        getDictionary().setItem( COSName.getPDFName( "Ff" ), ff );
    }
View Full Code Here

    {
        long ffval = getFlags();
        char[] bits = Long.toBinaryString(ffval).toCharArray();
        bits[bits.length-bitPos] = value ? '1' : '0';
        String s = new String(bits);
        COSInteger ff = new COSInteger(Integer.parseInt(s,2));
        getDictionary().setItem( COSName.getPDFName( "Ff" ), ff );
    }
View Full Code Here

     * @param bitPos the bitPosition to get the value from
     * @return true if the number at bitPos is '1'
     */
    protected boolean getFfFlag(int bitPos)
    {
        COSInteger ff = (COSInteger)getDictionary().getDictionaryObject( COSName.getPDFName( "Ff" ) );
        if (ff != null)
        {
            int bitMask = (int) Math.pow(2,bitPos-1);
            return (( ff.intValue() & bitMask) == bitMask);
        }
        else
        {
            return false;
        }
View Full Code Here

            else
            {
                throw new IOException( "Uknown field type:" + fieldValue.getClass().getName() );
            }
        }
        COSInteger ff = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "Ff" ) );
        if( ff != null )
        {
            setFlags( (int)ff.intValue() );
        }
        else
        {
            //these are suppose to be ignored if the Ff is set.
            COSInteger setFf = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "SetFf" ) );

            if( setFf != null )
            {
                int setFfInt = (int)setFf.intValue();
                docFlags = docFlags | setFfInt;
                setFlags( docFlags );
            }

            COSInteger clrFf = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "ClrFf" ) );
            if( clrFf != null )
            {
                //we have to clear the bits of the document fields for every bit that is
                //set in this field.
                //
                //Example:
                //docFf = 1011
                //clrFf = 1101
                //clrFfValue = 0010;
                //newValue = 1011 & 0010 which is 0010
                int clrFfValue = (int)clrFf.intValue();
                clrFfValue ^= 0xFFFFFFFF;
                docFlags = docFlags & clrFfValue;
                setFlags( docFlags );
            }
        }
        COSInteger f = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "F" ) );
        if( f != null )
        {
            setAnnotationFlags( (int)f.intValue() );
        }
        else
        {
            //these are suppose to be ignored if the F is set.
            COSInteger setF = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "SetF" ) );
            if( setF != null )
            {
                annotFlags = annotFlags | (int)setF.intValue();
                setAnnotationFlags( annotFlags );
            }

            COSInteger clrF = (COSInteger)fdfField.getDictionaryObject( COSName.getPDFName( "ClrF" ) );
            if( clrF != null )
            {
                //we have to clear the bits of the document fields for every bit that is
                //set in this field.
                //
                //Example:
                //docF = 1011
                //clrF = 1101
                //clrFValue = 0010;
                //newValue = 1011 & 0010 which is 0010
                int clrFValue = (int)clrF.intValue();
                clrFValue ^= 0xFFFFFFFFL;
                annotFlags = annotFlags & clrFValue;
                setAnnotationFlags( annotFlags );
            }
        }
View Full Code Here

     */
    private static int getFieldFlags( COSDictionary field )
    {
        //0 is default
        int retval = 0;
        COSInteger ff = (COSInteger)field.getDictionaryObject( COSName.getPDFName( "Ff" ) );
        if( ff != null )
        {
            retval = (int)ff.intValue();
        }
        return retval;
    }
View Full Code Here

TOP

Related Classes of org.pdfbox.cos.COSInteger

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.