Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSArray


     * @return The list of children or null if there are no children.
     */
    public List<PDNumberTreeNode> getKids()
    {
        List<PDNumberTreeNode> retval = null;
        COSArray kids = (COSArray)node.getDictionaryObject( COSName.KIDS );
        if( kids != null )
        {
            List<PDNumberTreeNode> pdObjects = new ArrayList<PDNumberTreeNode>();
            for( int i=0; i<kids.size(); i++ )
            {
                pdObjects.add( createChildNode( (COSDictionary)kids.getObject(i) ) );
            }
            retval = new COSArrayList<PDNumberTreeNode>(pdObjects,kids);
        }

        return retval;
View Full Code Here


     * @throws IOException If there is a problem creating the values.
     */
    public Map<Integer,COSObjectable> getNumbers()  throws IOException
    {
        Map<Integer, COSObjectable> indices = null;
        COSArray namesArray = (COSArray)node.getDictionaryObject( COSName.NUMS );
        if( namesArray != null )
        {
            indices = new HashMap<Integer,COSObjectable>();
            for( int i=0; i<namesArray.size(); i+=2 )
            {
                COSInteger key = (COSInteger)namesArray.getObject(i);
                COSBase cosValue = namesArray.getObject( i+1 );
                COSObjectable pdValue = convertCOSToPD( cosValue );
                indices.put( key.intValue(), pdValue );
            }
            indices = Collections.unmodifiableMap(indices);
        }
View Full Code Here

        }
        else
        {
            List<Integer> keys = new ArrayList<Integer>( numbers.keySet() );
            Collections.sort( keys );
            COSArray array = new COSArray();
            for (Integer key : keys)
            {
                array.add( COSInteger.get( key ) );
                COSObjectable obj = (COSObjectable)numbers.get( key );
                array.add( obj );
            }
            Integer lower = null;
            Integer upper = null;
            if( keys.size() > 0 )
            {
View Full Code Here

     * @return The highest value for a key in the map.
     */
    public Integer getUpperLimit()
    {
        Integer retval = null;
        COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS );
        if( arr != null && arr.get(0) != null )
        {
            retval = arr.getInt( 1 );
        }
        return retval;
    }
View Full Code Here

     *
     * @param upper The new highest value for a key in the map.
     */
    private void setUpperLimit( Integer upper )
    {
        COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS );
        if( arr == null )
        {
            arr = new COSArray();
            arr.add( null );
            arr.add( null );
            node.setItem( COSName.LIMITS, arr );
        }
        if ( upper != null)
        {
            arr.setInt( 1, upper);
        }
        else
        {
            arr.set( 1, null );
        }
    }
View Full Code Here

     * @return The lowest value for a key in the map.
     */
    public Integer getLowerLimit()
    {
        Integer retval = null;
        COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS );
        if( arr != null && arr.get(0) != null )
        {
            retval = arr.getInt( 0 );
        }
        return retval;
    }
View Full Code Here

     *
     * @param lower The new lowest value for a key in the map.
     */
    private void setLowerLimit( Integer lower )
    {
        COSArray arr = (COSArray)node.getDictionaryObject( COSName.LIMITS );
        if( arr == null )
        {
            arr = new COSArray();
            arr.add( null );
            arr.add( null );
            node.setItem( COSName.LIMITS, arr );
        }
        if ( lower != null )
        {
            arr.setInt( 0, lower);
        }
        else
        {
            arr.set( 0, null );
        }
    }
View Full Code Here

        COSBase contents = pageDictionary.getDictionaryObject(COSName.CONTENTS);
        if (contents instanceof COSStream)
        {
            COSStream contentsStream = (COSStream)contents;

            COSArray array = new COSArray();
            array.add(saveGraphicsStateStream);
            array.add(contentsStream);
            array.add(restoreGraphicsStateStream);

            pageDictionary.setItem(COSName.CONTENTS, array);
        }
        else if( contents instanceof COSArray )
        {
            COSArray contentsArray = (COSArray)contents;

            contentsArray.add(0, saveGraphicsStateStream);
            contentsArray.add(restoreGraphicsStateStream);
        }
        else
        {
            throw new IOException("Contents are unknown type: " + contents.getClass().getName());
        }
View Full Code Here

                if (!isMultiSelect())
                {
                    throw new IllegalArgumentException("The list box does allow multiple selection.");
                }
                String[] stringValues = (String[])value;
                COSArray stringArray = new COSArray();
                for (int i =0; i<stringValues.length;i++)
                {
                    stringArray.add(new COSString(stringValues[i]));
                }
                getDictionary().setItem(COSName.V, stringArray);
            }
        }
        else
View Full Code Here

    public COSArray getValue()
    {
        COSBase value = getDictionary().getDictionaryObject( COSName.V);
        if (value instanceof COSString)
        {
            COSArray array = new COSArray();
            array.add(value);
            return array;
        }
        else if (value instanceof COSArray)
        {
            return (COSArray)value;
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSArray

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.