Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSArray


                        if( cmap == null )
                        {
                            String cmapName = encodingName.getName();
                            if (encodingName.getName().equals( COSName.IDENTITY_H.getName() ))
                            {
                                COSArray descendantFontArray =
                                    (COSArray)font.getDictionaryObject( COSName.DESCENDANT_FONTS );
                                if (descendantFontArray != null)
                                {
                                    COSDictionary descendantFontDictionary =
                                        (COSDictionary)descendantFontArray.getObject( 0 );
                                    PDFont descendentFont = PDFontFactory.createFont( descendantFontDictionary );
                                    COSDictionary cidsysteminfo =
                                        (COSDictionary)descendentFont.font.getDictionaryObject(COSName.CIDSYSTEMINFO);
                                    if (cidsysteminfo != null)
                                    {
View Full Code Here


     *
     * @return The widths of the characters.
     */
    public List getWidths()
    {
        COSArray array = (COSArray)font.getDictionaryObject( COSName.WIDTHS );
        return COSArrayList.convertFloatCOSArrayToList( array );
    }
View Full Code Here

     * @return The matrix to transform from glyph space to text space.
     */
    public PDMatrix getFontMatrix()
    {
        PDMatrix matrix = null;
        COSArray array = (COSArray)font.getDictionaryObject( COSName.FONT_MATRIX );
        if( array == null )
        {
            array = new COSArray();
            array.add( new COSFloat( 0.001f ) );
            array.add( COSInteger.ZERO );
            array.add( COSInteger.ZERO );
            array.add( new COSFloat( 0.001f ) );
            array.add( COSInteger.ZERO );
            array.add( COSInteger.ZERO );
        }
        matrix = new PDMatrix(array);

        return matrix;
    }
View Full Code Here

        throws IOException
    {
        document = doc;

        PDEncryption dictionary = document.getEncryption();
        COSArray documentIDArray = document.getDocument().getDocumentID();
       
        prepareForDecryption(dictionary, documentIDArray, decryptionMaterial);
       
        proceedDecryption();
    }
View Full Code Here

                throw new IOException(e);
            }
        }
        else
        {
            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 )
            {
                MessageDigest md = MessageDigests.getMD5();
                BigInteger time = BigInteger.valueOf( System.currentTimeMillis() );
                md.update( time.toByteArray() );
                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);
View Full Code Here

     * @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 (byte[] recipient : recipients)
        {
            COSString recip = new COSString();
            recip.append(recipient);
            recip.setForceLiteralForm(true);
            array.add(recip);
        }
        dictionary.setItem(COSName.RECIPIENTS, array);
    }
View Full Code Here

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

     *
     * @return a COSString object containing information about the recipient number i.
     */
    public COSString getRecipientStringAt(int i)
    {
        COSArray array = (COSArray) dictionary.getItem(COSName.RECIPIENTS);
        return (COSString)array.get(i);
    }
View Full Code Here

    /**
     * Creates a new Lab color space.
     */
    public PDLab()
    {
        array = new COSArray();
        dictionary = new COSDictionary();
        array.add(COSName.LAB);
        array.add(dictionary);
    }
View Full Code Here

     * A default of 1,1,1 will be returned if the pdf does not have any values yet.
     * @return the whitepoint tristimulus
     */
    public PDTristimulus getWhitepoint()
    {
        COSArray wp = (COSArray)dictionary.getDictionaryObject(COSName.WHITE_POINT);
        if(wp == null)
        {
            wp = new COSArray();
            wp.add(new COSFloat(1.0f));
            wp.add(new COSFloat(1.0f));
            wp.add(new COSFloat(1.0f));
        }
        return new PDTristimulus(wp);
    }
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.