Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSBase


     *
     * @return the rich text stream.
     */
    public PDTextStream getRichContents()
    {
        COSBase rc = getDictionary().getDictionaryObject( "RC" );
        if (rc != null)
        {
            return PDTextStream.createTextStream( rc );
        }
        else
View Full Code Here


     * @throws IOException
     *             if there is an error with the annotation.
     */
    public PDAnnotation getInReplyTo() throws IOException
    {
        COSBase irt = getDictionary().getDictionaryObject( "IRT" );
        return PDAnnotation.createAnnotation( irt );
    }
View Full Code Here

     *
     * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs
     */
    public Map getNormalAppearance()
    {
        COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "N" ) );
        if( ap instanceof COSStream )
        {
            COSStream aux = (COSStream) ap;
            ap = new COSDictionary();
            ((COSDictionary)ap).setItem(COSName.getPDFName( "default" ), aux );
View Full Code Here

     * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs
     */
    public Map getRolloverAppearance()
    {
        Map retval = null;
        COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "R" ) );
        if( ap == null )
        {
            retval = getNormalAppearance();
        }
        else
View Full Code Here

     * @return A list of key(java.lang.String) value(PDAppearanceStream) pairs
     */
    public Map getDownAppearance()
    {
        Map retval = null;
        COSBase ap = dictionary.getDictionaryObject( COSName.getPDFName( "D" ) );
        if( ap == null )
        {
            retval = getNormalAppearance();
        }
        else
View Full Code Here

    {
        Iterator pagesIter = pages.iterator();
        while( pagesIter.hasNext() )
        {
            PDPage page = (PDPage)pagesIter.next();
            COSBase contents = page.getCOSDictionary().getDictionaryObject( COSName.CONTENTS );
            PDResources resources = page.findResources();
            if( resources == null )
            {
                resources = new PDResources();
                page.setResources( resources );
            }
            COSDictionary res = resources.getCOSDictionary();

            if( contents instanceof COSStream )
            {
                COSStream stream = (COSStream) contents;
                Map objectNameMap = new TreeMap();
                stream = makeUniqObjectNames(objectNameMap, stream);

                layoutPages.add(new LayoutPage(stream, res, objectNameMap));
            }
            else if( contents instanceof COSArray )
            {
                throw new UnsupportedOperationException("Layout pages with COSArray currently not supported.");
                // layoutPages.add(new LayoutPage(contents, res));
            }
            else
            {
                throw new IOException( "Contents are unknown type:" + contents.getClass().getName() );
            }
        }
    }
View Full Code Here

        Iterator pageIter = pages.iterator();
        while( pageIter.hasNext() )
        {
            PDPage page = (PDPage)pageIter.next();
            COSDictionary pageDictionary = page.getCOSDictionary();
            COSBase contents = pageDictionary.getDictionaryObject( COSName.CONTENTS );
            if( contents instanceof COSStream )
            {
                COSStream contentsStream = (COSStream)contents;
                // System.err.println("stream");
                pageCount++;

                COSArray array = new COSArray();

                array.add(contentsStream);

                mergePage( array, page );

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

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

            dest.setItem(name, destDict);
        }

        for (int sourceDictIdx = 0; sourceDict != null && sourceDictIdx<sourceDict.size(); sourceDictIdx++)
        {
            COSBase key = sourceDict.get(sourceDictIdx);
            if (key instanceof COSName)
            {
                COSName keyname = (COSName) key;

                boolean bFound = false;
                for (int destDictIdx = 0; destDictIdx<destDict.size(); destDictIdx++)
                {
                    COSBase destkey = destDict.get(destDictIdx);
                    if (destkey instanceof COSName)
                    {
                        COSName destkeyname = (COSName) destkey;
                        if (destkeyname.equals(keyname))
                        {
View Full Code Here

        }
       

        while( objectsToWrite.size() > 0 )
        {
            COSBase nextObject = (COSBase)objectsToWrite.remove( 0 );
            doWriteObject( nextObject );
        }
       
       
        willEncrypt = false;
       
        if( encrypt != null )
        {
            addObjectToWrite( encrypt );
        }
       
        while( objectsToWrite.size() > 0 )
        {
            COSBase nextObject = (COSBase)objectsToWrite.remove( 0 );
            doWriteObject( nextObject );
        }

        // write all objects
        /**
 
View Full Code Here

        }**/
    }

    private void addObjectToWrite( COSBase object )
    {
        COSBase actual = object;
        if( actual instanceof COSObject )
        { 
            actual = ((COSObject)actual).getObject();
        }
       
View Full Code Here

TOP

Related Classes of org.pdfbox.cos.COSBase

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.