Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSArray


     * @return A list of java.lang.String values.
     */
    public List<String> getOptions()
    {
        List<String> retval = null;
        COSArray array = (COSArray)getDictionary().getDictionaryObject( COSName.OPT );
        if( array != null )
        {
            List<String> strings = new ArrayList<String>();
            for( int i=0; i<array.size(); i++ )
            {
                strings.add( ((COSString)array.getObject( i )).getString() );
            }
            retval = new COSArrayList<String>( strings, array );
        }
        return retval;
    }
View Full Code Here


        {
            // handle the case if the XFA is split into individual parts
            if (this.getCOSObject() instanceof COSArray)
            {
                xfaBytes = new byte[1024];
                COSArray cosArray = (COSArray) this.getCOSObject();
                for (int i = 1; i < cosArray.size(); i += 2)
                {
                    COSBase cosObj = cosArray.getObject(i);
                    if (cosObj instanceof COSStream)
                    {
                        is = ((COSStream) cosObj).getUnfilteredStream();
                        int nRead = 0;
                        while ((nRead = is.read(xfaBytes, 0, xfaBytes.length)) != -1)
View Full Code Here

            float[] values = new float[ rectValues.length ];
            for( int i=0; i<rectValues.length; i++ )
            {
                values[i] = Float.parseFloat( rectValues[i] );
            }
            COSArray array = new COSArray();
            array.setFloatArray( values );
            setRectangle( new PDRectangle( array ) );
        }

        setName( element.getAttribute( "title" ) );
        setCreationDate( DateConverter.toCalendar( element.getAttribute( "creationdate" ) ) );
View Full Code Here

     * @return The annotation color, or null if there is none.
     */
    public Color getColor()
    {
        Color retval = null;
        COSArray array = (COSArray)annot.getDictionaryObject( "color" );
        if( array != null )
        {
            float[] rgb = array.toFloatArray();
            if( rgb.length >=3 )
            {
                retval = new Color( rgb[0], rgb[1], rgb[2] );
            }
        }
View Full Code Here

     *
     * @param c The annotation color.
     */
    public void setColor( Color c )
    {
        COSArray color = null;
        if( c != null )
        {
            float[] colors = c.getRGBColorComponents( null );
            color = new COSArray();
            color.setFloatArray( colors );
        }
        annot.setItem( "color", color );
    }
View Full Code Here

     * @return The annotation rectangle.
     */
    public PDRectangle getRectangle()
    {
        PDRectangle retval = null;
        COSArray rectArray = (COSArray)annot.getDictionaryObject( COSName.RECT );
        if( rectArray != null )
        {
            retval = new PDRectangle( rectArray );
        }
        return retval;
View Full Code Here

     * @param width The width of the rectangle.
     * @param height The height of the rectangle.
     */
    public PDRectangle( float x, float y, float width, float height )
    {
        rectArray = new COSArray();
        rectArray.add( new COSFloat( x ) );
        rectArray.add( new COSFloat( y ) );
        rectArray.add( new COSFloat( x + width ) );
        rectArray.add( new COSFloat( y + height ) );
    }
View Full Code Here

     *
     * @param box the bounding box to be used for the rectangle
     */
    public PDRectangle( BoundingBox box )
    {
        rectArray = new COSArray();
        rectArray.add( new COSFloat( box.getLowerLeftX() ) );
        rectArray.add( new COSFloat( box.getLowerLeftY() ) );
        rectArray.add( new COSFloat( box.getUpperRightX() ) );
        rectArray.add( new COSFloat( box.getUpperRightY() ) );
    }
View Full Code Here

     * @param array An array of numbers as specified in the PDF Reference for a rectangle type.
     */
    public PDRectangle( COSArray array )
    {
        float[] values = array.toFloatArray();
        rectArray = new COSArray();
        // we have to start with the lower left corner
        rectArray.add( new COSFloat( Math.min(values[0],values[2] )) );
        rectArray.add( new COSFloat( Math.min(values[1],values[3] )) );
        rectArray.add( new COSFloat( Math.max(values[0],values[2] )) );
        rectArray.add( new COSFloat( Math.max(values[1],values[3] )) );
View Full Code Here

     */
    public PDRectangle getMediaBox()
    {
        if (mediaBox == null)
        {
            COSArray array = (COSArray) PDPageTree.getInheritableAttribute(page, COSName.MEDIA_BOX);
            if (array != null)
            {
                mediaBox = new PDRectangle(array);
            }
        }
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.