Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSInteger


    {
        ImageReader reader = findImageReader("JBIG2", "jbig2-imageio is not installed");
        DecodeResult result = new DecodeResult(new COSDictionary());
        result.getParameters().addAll(parameters);

        COSInteger bits = (COSInteger) parameters.getDictionaryObject(COSName.BITS_PER_COMPONENT);
        COSDictionary params = (COSDictionary) parameters.getDictionaryObject(COSName.DECODE_PARMS);

        COSStream globals = null;
        if (params != null)
        {
            globals = (COSStream) params.getDictionaryObject(COSName.JBIG2_GLOBALS);
        }

        ImageInputStream iis = null;
        try
        {
            if (globals != null)
            {
                iis = ImageIO.createImageInputStream(
                        new SequenceInputStream(globals.getUnfilteredStream(), encoded));
                reader.setInput(iis);
            }
            else
            {
                iis = ImageIO.createImageInputStream(encoded);
                reader.setInput(iis);
            }

            BufferedImage image;
            try
            {
                image = reader.read(0);
            }
            catch (Exception e)
            {
                // wrap and rethrow any exceptions
                throw new IOException("Could not read JBIG2 image", e);
            }

            // I am assuming since JBIG2 is always black and white
            // depending on your renderer this might or might be needed
            if (image.getColorModel().getPixelSize() != bits.intValue())
            {
                if (bits.intValue() != 1)
                {
                    LOG.warn("Attempting to handle a JBIG2 with more than 1-bit depth");
                }
                BufferedImage packedImage = new BufferedImage(image.getWidth(), image.getHeight(),
                        BufferedImage.TYPE_BYTE_BINARY);
View Full Code Here


        if( namesArray != null )
        {
            indices = new HashMap<Integer,COSObjectable>();
            for( int i=0; i<namesArray.size(); i+=2 )
            {
                COSInteger key = (COSInteger)namesArray.getObject(i);
                COSBase cosValue = namesArray.getObject( i+1 );
                COSObjectable pdValue = convertCOSToPD( cosValue );
                indices.put( key.intValue(), pdValue );
            }
            indices = Collections.unmodifiableMap(indices);
        }
        return indices;
    }
View Full Code Here

     */
    @Override
    public int getFieldFlags()
    {
        int retval = 0;
        COSInteger ff = (COSInteger) getDictionary().getDictionaryObject(COSName.FF);
        if (ff != null)
        {
            retval = ff.intValue();
        }
        else if (getParent() != null)
        {
            retval = getParent().getFieldFlags();
        }
View Full Code Here

     */
    @Override
    public int getFieldFlags()
    {
        int retval = 0;
        COSInteger ff = (COSInteger) getDictionary().getDictionaryObject(COSName.FF);
        if (ff != null)
        {
            retval = ff.intValue();
        }
        // There is no need to look up the parent hierarchy within a non terminal field
        return retval;
    }
View Full Code Here

        }
        else if (kid instanceof COSInteger)
        {
            // An integer marked-content identifier denoting a
            // marked-content sequence
            COSInteger mcid = (COSInteger) kid;
            return mcid.intValue();
        }
        return null;
    }
View Full Code Here

            appendRawCommands(SPACE);
            appendRawCommands(OPENING_BRACKET);
            appendRawCommands(SPACE);
            for (COSBase cosBase : inlineImage.getDecode())
            {
                COSInteger cosInt = (COSInteger) cosBase;
                appendRawCommands(Integer.toString(cosInt.intValue()));
                appendRawCommands(SPACE);
            }
            appendRawCommands(CLOSING_BRACKET);
            appendRawCommands("\n");
        }
View Full Code Here

        String type = obj.getNameAsString(COSName.TYPE);
        if (lengthEntry != null && lengthEntry.isDirect() || "XRef".equals(type))
        {
            // the length might be the non encoded length,
            // set the real one as direct object
            COSInteger cosInteger = COSInteger.get(obj.getFilteredLength());
            cosInteger.setDirect(true);
            obj.setItem(COSName.LENGTH, cosInteger);
        }
        else
        {
            // make the length an implicit indirect object
View Full Code Here

            if( pbo instanceof COSObject )
            {
                // We have to check if the expected values are there or not PDFBOX-385
                if (po.get(po.size()-1) instanceof COSInteger)
                {
                    COSInteger genNumber = (COSInteger)po.remove( po.size() -1 );
                    if (po.get(po.size()-1) instanceof COSInteger)
                    {
                        COSInteger number = (COSInteger)po.remove( po.size() -1 );
                        COSObjectKey key = new COSObjectKey(number.intValue(), genNumber.intValue());
                        pbo = document.getObjectFromPool(key);
                    }
                    else
                    {
                        // the object reference is somehow wrong
View Full Code Here

     *
     * @param ff The new value for the field flags.
     */
    public void setFieldFlags( Integer ff )
    {
        COSInteger value = null;
        if( ff != null )
        {
            value = COSInteger.get( ff );
        }
        field.setItem( COSName.FF, value );
View Full Code Here

     *
     * @param ff The new value for the "set field flags".
     */
    public void setSetFieldFlags( Integer ff )
    {
        COSInteger value = null;
        if( ff != null )
        {
            value = COSInteger.get( ff );
        }
        field.setItem( COSName.SET_FF, value );
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSInteger

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.