Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSObject


                    currentObjectKey.getGeneration());
            }
           
            InputStream input = obj.getFilteredStream();
            // set the length of the stream and write stream dictionary
            COSObject lengthObject = new COSObject( null );
           
            obj.setItem(COSName.LENGTH, lengthObject);
            //obj.accept(this);
            // write the stream content
            visitFromDictionary( obj );
            getStandardOutput().write(STREAM);
            getStandardOutput().writeCRLF();
            byte[] buffer = new byte[1024];
            int amountRead = 0;
            int totalAmountWritten = 0;
            while( (amountRead = input.read(buffer,0,1024)) != -1 )
            {
                getStandardOutput().write( buffer, 0, amountRead );
                totalAmountWritten += amountRead;
            }
            lengthObject.setObject( new COSInteger( totalAmountWritten ) );
            getStandardOutput().writeCRLF();
            getStandardOutput().write(ENDSTREAM);
            getStandardOutput().writeEOL();
            return null;
        }
View Full Code Here


                }
                break;
            }
            case 'R':
                pdfSource.read();
                retval = new COSObject(null);
                break;
            case (char)-1:
                return null;
            default:
            {
View Full Code Here

            case 'R':
            {
                String line = readString();
                if( line.equals( "R" ) )
                {
                    retval = new COSObject( null );
                }
                else
                {
                    retval = PDFOperator.getOperator( line );
                }
View Full Code Here

            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();
View Full Code Here

            {
                int objectNumber = readInt();
                int offset = readInt();
                objectNumbers.add( new Integer( objectNumber ) );
            }
            COSObject object = null;
            COSBase cosObject = null;
            int objectCounter = 0;
            while( (cosObject = parseDirObject()) != null )
            {
                object = new COSObject(cosObject);
                object.setGenerationNumber( COSInteger.ZERO );
                COSInteger objNum =
                    new COSInteger( ((Integer)objectNumbers.get( objectCounter)).intValue() );
                object.setObjectNumber( objNum );
                streamObjects.add( object );
                objectCounter++;
            }
        }
        finally
View Full Code Here

                    throw new IOException("stream not preceded by dictionary");
                }
                endObjectKey = readString();
            }
            COSObjectKey key = new COSObjectKey( number, genNum );
            COSObject pdfObject = document.getObjectFromPool( key );
            object = pdfObject;
            pdfObject.setObject(pb);

            if( !endObjectKey.equals( "endobj" ) )
            {
                if( !pdfSource.isEOF() )
                {
View Full Code Here

    public COSDictionary getPages(COSDocument doc)
    {
        // todo should access via catalog instead!
        for (Iterator i = doc.getObjects().iterator(); i.hasNext();)
        {
            COSObject obj = (COSObject) i.next();
            COSBase base = obj.getObject();
            if (base instanceof COSDictionary)
            {
                COSDictionary dict = (COSDictionary) base;
                COSBase type = dict.getItem(COSName.TYPE);
                if (type != null && type.equals(COSName.getPDFName("Pages")))
View Full Code Here

     */
    public void setField(COSDocument doc, String prefix, COSString name, COSString value)
    {
        for (Iterator i = doc.getObjects().iterator(); i.hasNext();)
        {
            COSObject obj = (COSObject) i.next();
            COSBase base = obj.getObject();
            if (base instanceof COSDictionary)
            {
                COSDictionary dict = (COSDictionary) base;
                COSBase type = dict.getItem(COSName.TYPE);
                if (type != null && type.equals(COSName.getPDFName("Annot")))
View Full Code Here

            case 'R':
            {
                String line = readString();
                if( line.equals( "R" ) )
                {
                    retval = new COSObject( null );
                }
                else
                {
                    retval = PDFOperator.getOperator( line );
                }
View Full Code Here

     */
    public void setField(COSDocument doc, COSString name, COSString value)
    {
        for (Iterator i = doc.getObjects().iterator(); i.hasNext();)
        {
            COSObject obj = (COSObject) i.next();
            COSBase base = obj.getObject();
            if (base instanceof COSDictionary)
            {
                COSDictionary dict = (COSDictionary) base;
                COSBase type = dict.getItem(COSName.TYPE);
                if (type != null && type.equals(COSName.getPDFName("Annot")))
View Full Code Here

TOP

Related Classes of org.pdfbox.cos.COSObject

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.