Examples of COSObject


Examples of org.apache.pdfbox.cos.COSObject

     *
     * @param parsedTrailer the parsed catalog in the trailer
     */
    protected void readVersionInTrailer(COSDictionary parsedTrailer)
    {
        COSObject root = (COSObject) parsedTrailer.getItem(COSName.ROOT);
        if (root != null)
        {
            COSBase item = root.getItem(COSName.VERSION);
            if (item instanceof COSName)
            {
                COSName version = (COSName) item;
                float trailerVersion = Float.valueOf(version.getName());
                if (trailerVersion > document.getVersion())
View Full Code Here

Examples of org.apache.pdfbox.cos.COSObject

                do
                {
                    ConflictObj o = conflicts.next();
                    if (tolerantConflicResolver(values, o.offset, 4))
                    {
                        COSObject pdfObject = document.getObjectFromPool(o.objectKey);
                        if (pdfObject.getObjectNumber() != null
                                && pdfObject.getObjectNumber().equals(o.object.getObjectNumber()))
                        {
                            pdfObject.setObject(o.object.getObject());
                        }
                        else
                        {
                            LOG.debug("Conflict object [" + o.objectKey + "] at offset " + o.offset
                                    +" found in the xref table, but the object numbers differ. Ignoring this object."
View Full Code Here

Examples of org.apache.pdfbox.cos.COSObject

    @Test
    public void testIsString()
    {
        try
        {
            COSObject co = new COSObject(new COSString(""));
            co.setGenerationNumber(COSInteger.ZERO);
            co.setObjectNumber(COSInteger.get(10));

            assertFalse(COSUtils.isString(co, new IOCOSDocument()));

            COSDocument doc = new COSDocument();
            addToXref(doc, new COSObjectKey(co), 1000);
View Full Code Here

Examples of org.apache.pdfbox.cos.COSObject

    @Test
    public void testIsStream()
    {
        try
        {
            COSObject co = new COSObject(new COSStream());
            co.setGenerationNumber(COSInteger.ZERO);
            co.setObjectNumber(COSInteger.get(10));

            assertFalse(COSUtils.isStream(co, new IOCOSDocument()));

            COSDocument doc = new COSDocument();
            addToXref(doc, new COSObjectKey(co), 1000);
View Full Code Here

Examples of org.apache.pdfbox.cos.COSObject

    @Test
    public void testIsDictionary()
    {
        try
        {
            COSObject co = new COSObject(new COSDictionary());
            co.setGenerationNumber(COSInteger.ZERO);
            co.setObjectNumber(COSInteger.get(10));

            assertFalse(COSUtils.isDictionary(co, new IOCOSDocument()));

            COSDocument doc = new COSDocument();
            addToXref(doc, new COSObjectKey(co), 1000);
View Full Code Here

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

Examples of org.pdfbox.cos.COSObject

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

Examples of org.pdfbox.cos.COSObject

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

Examples of org.pdfbox.cos.COSObject

            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

Examples of org.pdfbox.cos.COSObject

            {
                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
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.