Examples of COSArray


Examples of org.pdfbox.cos.COSArray

        {
            //we are done, it has already been converted.
        }
        else if( base instanceof List )
        {
            COSArray array = new COSArray();
            List list = (List)base;
            for( int i=0; i<list.size(); i++ )
            {
                array.add( cloneForNewDocument( destination, list.get( i ) ) );
            }
            retval = array;
        }
        else if( base instanceof COSObjectable && !(base instanceof COSBase) )
        {
            retval = cloneForNewDocument( destination, ((COSObjectable)base).getCOSObject() );
            clonedVersion.put( base, retval );
        }
        else if( base instanceof COSObject )
        {
            COSObject object = (COSObject)base;
            retval = cloneForNewDocument( destination, object.getObject() );
            clonedVersion.put( base, retval );
        }
        else if( base instanceof COSArray )
        {
            COSArray newArray = new COSArray();
            COSArray array = (COSArray)base;
            for( int i=0; i<array.size(); i++ )
            {
                newArray.add( cloneForNewDocument( destination, array.get( i ) ) );
            }
            retval = newArray;
            clonedVersion.put( base, retval );
        }
        else if( base instanceof COSStream )
View Full Code Here

Examples of org.pdfbox.cos.COSArray

                }

                COSDictionary trailer = document.getDocument().getTrailer();
                COSDictionary root = (COSDictionary)trailer.getDictionaryObject( COSName.ROOT );
                COSDictionary acroForm = (COSDictionary)root.getDictionaryObject( COSName.getPDFName( "AcroForm" ) );
                COSArray fields = (COSArray)acroForm.getDictionaryObject( COSName.getPDFName( "Fields" ) );
                for( int i=0; i<fields.size(); i++ )
                {
                    COSDictionary field = (COSDictionary)fields.getObject( i );
                    String type = field.getNameAsString( "FT" );
                    if( "Sig".equals( type ) )
                    {
                        COSDictionary cert = (COSDictionary)field.getDictionaryObject( COSName.getPDFName( "V" ) );
                        if( cert != null )
View Full Code Here

Examples of org.pdfbox.cos.COSArray

            int flags = pdField.getFieldFlags();
            //BJL, I have found that the radio flag bit is not always set
            //and that sometimes there is just a kids dictionary.
            //so, if there is a kids dictionary then it must be a radio button
            //group.
            COSArray kids = (COSArray)field.getDictionaryObject( COSName.getPDFName( "Kids" ) );
            if( kids != null || isRadio(flags) )
            {
                pdField = new PDRadioCollection( acroForm, field );
            }
            else if( isPushButton( flags ) )
View Full Code Here

Examples of org.pdfbox.cos.COSArray

       
        encryptionDictionary.setPermissions(permissionInt);
       
        int length = keyLength/8;
       
        COSArray idArray = document.getDocument().getDocumentID();

        //check if the document has an id yet.  If it does not then
        //generate one
        if( idArray == null || idArray.size() < 2 )
        {
            idArray = new COSArray();
            try
            {
                MessageDigest md = MessageDigest.getInstance( "MD5" );
                BigInteger time = BigInteger.valueOf( System.currentTimeMillis() );
                md.update( time.toByteArray() );
                md.update( ownerPassword.getBytes() );
                md.update( userPassword.getBytes() );
                md.update( document.getDocument().toString().getBytes() );
                byte[] id = md.digest( this.toString().getBytes() );
                COSString idString = new COSString();
                idString.append( id );
                idArray.add( idString );
                idArray.add( idString );
                document.getDocument().setDocumentID( idArray );
            }
            catch( NoSuchAlgorithmException e )
            {
                throw new CryptographyException( e );
            }
            catch(IOException e )
            {
                throw new CryptographyException( e );
            }
        }
       
        COSString id = (COSString)idArray.getObject( 0 );       
       
        byte[] o = computeOwnerPassword(
            ownerPassword.getBytes("ISO-8859-1"),
            userPassword.getBytes("ISO-8859-1"), revision, length);
View Full Code Here

Examples of org.pdfbox.cos.COSArray

     */
    public PDAcroForm( PDDocument doc )
    {
        document = doc;
        acroForm = new COSDictionary();
        COSArray fields = new COSArray();
        acroForm.setItem( COSName.getPDFName( "Fields" ), fields );
    }
View Full Code Here

Examples of org.pdfbox.cos.COSArray

     * @throws IOException If there is an error while getting the list of fields.
     */
    public List getFields() throws IOException
    {
        List retval = null;
        COSArray fields =
            (COSArray) acroForm.getDictionaryObject(
                COSName.getPDFName("Fields"));
       
        if( fields != null )
        {
            List actuals = new ArrayList();
            for (int i = 0; i < fields.size(); i++)
            {
                COSDictionary element = (COSDictionary) fields.getObject(i);
                if (element != null)
                {
                    PDField field = PDFieldFactory.createField( this, element );
                    if( field != null )
                    {
View Full Code Here

Examples of org.pdfbox.cos.COSArray

            retval = (PDField)fieldCache.get( name );
        }
        else
        {
            String[] nameSubSection = name.split( "\\." );
            COSArray fields =
                (COSArray) acroForm.getDictionaryObject(
                    COSName.getPDFName("Fields"));

            for (int i = 0; i < fields.size() && retval == null; i++)
            {
                COSDictionary element = (COSDictionary) fields.getObject(i);
                if( element != null )
                {
                    COSString fieldName =
                        (COSString)element.getDictionaryObject( COSName.getPDFName( "T" ) );
                    if( fieldName.getString().equals( name ) ||
View Full Code Here

Examples of org.pdfbox.cos.COSArray

     * @param recipients the array of bytes arrays to put in the Recipients field.
     * @throws IOException If there is an error setting the data.
     */
    public void setRecipients(byte[][] recipients) throws IOException
    {       
        COSArray array = new COSArray();
        for(int i=0; i<recipients.length; i++)
        {
            COSString recip = new COSString();
            recip.append(recipients[i]);
            recip.setForceLiteralForm(true);           
            array.add(recip);
        }
        encryptionDictionary.setItem(COSName.getPDFName("Recipients"), array);
    }
View Full Code Here

Examples of org.pdfbox.cos.COSArray

     *
     * @return the number of recipients contained in the Recipients field.
     */
    public int getRecipientsLength()
    {
        COSArray array = (COSArray)encryptionDictionary.getItem(COSName.getPDFName("Recipients"));
        return array.size();
    }
View Full Code Here

Examples of org.pdfbox.cos.COSArray

     *
     * @return a COSString object containing information about the recipient number i.
     */
    public COSString getRecipientStringAt(int i)
    {
        COSArray array = (COSArray)encryptionDictionary.getItem(COSName.getPDFName("Recipients"));
        return (COSString)array.get(i);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.