Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSString


     *
     * @param dest The named destination.
     */
    public PDNamedDestination( String dest )
    {
        namedDestination = new COSString( dest );
    }
View Full Code Here


     */
    public void setNamedDestination( String dest ) throws IOException
    {
        if( namedDestination instanceof COSString )
        {
            COSString string = ((COSString)namedDestination);
            string.reset();
            string.append( dest.getBytes() );
        }
        else if( dest == null )
        {
            namedDestination = null;
        }
        else
        {
            namedDestination = new COSString( dest );
        }
    }
View Full Code Here

                }

            }
            else if( baseFont instanceof COSString )
            {
                COSString string = (COSString)baseFont;
                name = string.getString();
            }
            if( name != null )
            {
                afm = afmObjects.get( name );
            }
View Full Code Here

        //some documents may have not document id, see
        //test\encryption\encrypted_doc_no_id.pdf
        byte[] documentIDBytes;
        if( documentIDArray != null && documentIDArray.size() >= 1 )
        {
            COSString id = (COSString)documentIDArray.getObject( 0 );
            documentIDBytes = id.getBytes();
        }
        else
        {
            documentIDBytes = new byte[0];
        }
View Full Code Here

                md.update( ownerPassword.getBytes("ISO-8859-1") );
                md.update( userPassword.getBytes("ISO-8859-1") );
                md.update( document.getDocument().toString().getBytes() );

                byte[] id = md.digest( this.toString().getBytes("ISO-8859-1") );
                COSString idString = new COSString();
                idString.append( id );

                idArray = new COSArray();
                idArray.add( idString );
                idArray.add( idString );
                document.getDocument().setDocumentID( idArray );
            }

            COSString id = (COSString)idArray.getObject( 0 );

            byte[] ownerBytes = computeOwnerPassword(
                ownerPassword.getBytes("ISO-8859-1"),
                userPassword.getBytes("ISO-8859-1"), revision, length);

            byte[] userBytes = computeUserPassword(
                userPassword.getBytes("ISO-8859-1"),
                ownerBytes, permissionInt, id.getBytes(), revision, length, true);

            encryptionKey = computeEncryptedKey(userPassword.getBytes("ISO-8859-1"), ownerBytes,
                    null, null, null, permissionInt, id.getBytes(), revision, length, true, false);

            encryptionDictionary.setOwnerKey(ownerBytes);
            encryptionDictionary.setUserKey(userBytes);
        }
View Full Code Here

     *
     * @throws IOException If there is an error setting the data.
     */
    public void setOwnerKey(byte[] o) throws IOException
    {
        COSString owner = new COSString();
        owner.append( o );
        dictionary.setItem(COSName.O, owner);
    }
View Full Code Here

     * @throws IOException If there is an error accessing the data.
     */
    public byte[] getOwnerKey() throws IOException
    {
        byte[] o = null;
        COSString owner = (COSString) dictionary.getDictionaryObject( COSName.O );
        if( owner != null )
        {
            o = owner.getBytes();
        }
        return o;
    }
View Full Code Here

     *
     * @throws IOException If there is an error setting the data.
     */
    public void setUserKey(byte[] u) throws IOException
    {
        COSString user = new COSString();
        user.append( u );
        dictionary.setItem(COSName.U, user);
    }
View Full Code Here

     * @throws IOException If there is an error accessing the data.
     */
    public byte[] getUserKey() throws IOException
    {
        byte[] u = null;
        COSString user = (COSString) dictionary.getDictionaryObject( COSName.U );
        if( user != null )
        {
            u = user.getBytes();
        }
        return u;
    }
View Full Code Here

     *
     * @throws IOException If there is an error setting the data.
     */
    public void setOwnerEncryptionKey(byte[] oe) throws IOException
    {
        COSString ownerEncryptionKey = new COSString();
        ownerEncryptionKey.append(oe);
        dictionary.setItem( COSName.OE, ownerEncryptionKey );
    }
View Full Code Here

TOP

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

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.