Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSObject


        if (cbase instanceof COSObject)
        {
            try
            {
                COSObjectKey key = new COSObjectKey((COSObject) cbase);
                COSObject obj = cDoc.getObjectFromPool(key);
                if (obj != null && obj.getObject() instanceof COSArray)
                {
                    return (COSArray) obj.getObject();
                }
                else
                {
                    return null;
                }
View Full Code Here


    /**
     * Return the xpacket from the dictionary's stream
     */
    public static byte[] getXpacket(COSDocument cdocument) throws IOException, XpacketParsingException
    {
        COSObject catalog = cdocument.getCatalog();
        COSBase cb = catalog.getDictionaryObject(COSName.METADATA);
        if (cb == null)
        {
            // missing Metadata Key in catalog
            ValidationError error = new ValidationError(PreflightConstants.ERROR_METADATA_FORMAT,
                    "Missing Metadata Key in catalog");
View Full Code Here

        if (cbase instanceof COSObject)
        {
            try
            {
                COSObjectKey key = new COSObjectKey((COSObject) cbase);
                COSObject obj = cDoc.getObjectFromPool(key);
                if (obj != null && obj.getObject() instanceof COSString)
                {
                    return ((COSString) obj.getObject()).getString();
                }
                else if (obj != null && obj.getObject() instanceof COSName)
                {
                    return ((COSName) obj.getObject()).getName();
                }
                else
                {
                    return null;
                }
View Full Code Here

                skipSpaces();
                endObjectKey = readLine();
            }

            COSObjectKey key = new COSObjectKey( number, genNum );
            COSObject pdfObject = document.getObjectFromPool( key );
            if(pdfObject.getObject() == null)
            {
                pdfObject.setObject(pb);
            }
            /*
             * If the object we returned already has a baseobject, then we have a conflict
             * which we will resolve using information after we parse the xref table.
             */
 
View Full Code Here

        if (cbase instanceof COSObject)
        {
            try
            {
                COSObjectKey key = new COSObjectKey((COSObject) cbase);
                COSObject obj = cDoc.getObjectFromPool(key);
                if (obj != null && obj.getObject() instanceof COSDictionary)
                {
                    return (COSDictionary) obj.getObject();
                }
                else
                {
                    return null;
                }
View Full Code Here

    * @param pb The COSBase of this conflictObj
    * @throws IOException
    */
    private void addObjectToConflicts(long offset, COSObjectKey key, COSBase pb) throws IOException
    {
        COSObject obj = new COSObject(null);
        obj.setObjectNumber( COSInteger.get( key.getNumber() ) );
        obj.setGenerationNumber( COSInteger.get( key.getGeneration() ) );
        obj.setObject(pb);
        ConflictObj conflictObj = new ConflictObj(offset, key, obj);
        conflictList.add(conflictObj);
    }
View Full Code Here

        if (cbase instanceof COSObject)
        {
            try
            {
                COSObjectKey key = new COSObjectKey((COSObject) cbase);
                COSObject obj = cDoc.getObjectFromPool(key);
                if (obj != null && obj.getObject() instanceof COSStream)
                {
                    return (COSStream) obj.getObject();
                }
                else
                {
                    return null;
                }
View Full Code Here

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

        if (cbase instanceof COSObject)
        {
            try
            {
                COSObjectKey key = new COSObjectKey((COSObject) cbase);
                COSObject obj = cDoc.getObjectFromPool(key);
                if (obj == null)
                {
                    return null;
                }
                else if (obj.getObject() instanceof COSFloat)
                {
                    return ((COSFloat) obj.getObject()).floatValue();
                }
                else if (obj.getObject() instanceof COSInteger)
                {
                    return (float) ((COSInteger) obj.getObject()).intValue();
                }
                else
                {
                    return null;
                }
View Full Code Here

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

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

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

TOP

Related Classes of org.apache.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.