Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSStream


        }
        else
        {
            if( ap instanceof COSStream )
            {
                COSStream aux = (COSStream) ap;
                ap = new COSDictionary();
                ((COSDictionary)ap).setItem(COSName.getPDFName( "default" ), aux );
            }
            COSDictionary map = (COSDictionary)ap;
            Map actuals = new HashMap();
            retval = new COSDictionaryMap( actuals, map );
            Iterator asNames = map.keyList().iterator();
            while( asNames.hasNext() )
            {
                COSName asName = (COSName)asNames.next();
                COSStream as = (COSStream)map.getDictionaryObject( asName );
                actuals.put( asName.getName(), new PDAppearanceStream( as ) );
            }
        }

        return retval;
View Full Code Here


     * @return The metadata for this object.
     */
    public PDMetadata getMetadata()
    {
        PDMetadata retval = null;
        COSStream stream = (COSStream)page.getDictionaryObject( COSName.METADATA );
        if( stream != null )
        {
            retval = new PDMetadata( stream );
        }
        return retval;
View Full Code Here

            retval = new PDType1Font( dic );

            COSDictionary fontDic = (COSDictionary)dic.getDictionaryObject(COSName.FONT_DESC);
            if( fontDic != null )
            {
                COSStream ffStream = (COSStream)fontDic.getDictionaryObject("FontFile");
                COSStream ff3Stream = (COSStream)fontDic.getDictionaryObject("FontFile3");

                if( ffStream == null && ff3Stream != null )
                {
                    String ff3SubType = ff3Stream.getNameAsString(COSName.SUBTYPE);
                    if( ff3SubType.equals("Type1C") )
                    {
                        retval = new PDType1CFont( dic );
                    }
                }
View Full Code Here

    private byte[] loadBytes() throws IOException
    {
        COSDictionary fontDic = (COSDictionary)super.font.getDictionaryObject(COSName.FONT_DESC);
        if( fontDic != null )
        {
            COSStream ff3Stream = (COSStream)fontDic.getDictionaryObject("FontFile3");
            if( ff3Stream != null )
            {
                ByteArrayOutputStream os = new ByteArrayOutputStream();

                InputStream is = ff3Stream.getUnfilteredStream();
                try
                {
                    byte[] buf = new byte[512];
                    while(true)
                    {
View Full Code Here

            }
        }
        else if(xobject instanceof PDXObjectForm)
        {
            PDXObjectForm form = (PDXObjectForm)xobject;
            COSStream invoke = (COSStream)form.getCOSObject();
            PDResources pdResources = form.getResources();
            if(pdResources == null)
            {
                pdResources = page.findResources();
            }
View Full Code Here

        {
            if( cmap == null )
            {
                if( font.getDictionaryObject( COSName.TO_UNICODE ) instanceof COSStream )
                {
                    COSStream toUnicode = (COSStream)font.getDictionaryObject( COSName.TO_UNICODE );
                    if( toUnicode != null )
                    {
                        parseCmap( null, toUnicode.getUnfilteredStream(), null );
                    }
                }
                else
                {
                    COSBase encoding = getEncodingObject(); //font.getDictionaryObject( COSName.ENCODING );
                    if( encoding instanceof COSStream )
                    {
                        COSStream encodingStream = (COSStream)encoding;
                        parseCmap( null, encodingStream.getUnfilteredStream(), null );
                    }
                    else if( isType0Font() && encoding instanceof COSName )
                    {
                        COSName encodingName = (COSName)encoding;
                        cmap = cmapObjects.get( encodingName );
View Full Code Here

        //font dictionary
        COSDictionary fontDescriptor = (COSDictionary) font.getDictionaryObject(
            COSName.FONT_DESC);
        if( fontDescriptor != null )
        {
            COSStream fontFile = (COSStream) fontDescriptor.getDictionaryObject(
                COSName.FONT_FILE);
            if( fontFile != null )
            {
                BufferedReader in =
                        new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
                /**
                 * this section parse the FileProgram stream searching for a /Encoding entry
                 * the research stop if the entry "currentdict end" is reach or after 100 lignes
                 */
                StringTokenizer st = null;
View Full Code Here

        }
        else if( lookupTable instanceof COSStream )
        {
            //Data will be small so just load the whole thing into memory for
            //easier processing
            COSStream lookupStream = (COSStream)lookupTable;
            InputStream input = lookupStream.getUnfilteredStream();
            ByteArrayOutputStream output = new ByteArrayOutputStream(1024);
            byte[] buffer = new byte[ 1024 ];
            int amountRead;
            while( (amountRead = input.read(buffer, 0, buffer.length)) != -1 )
            {
View Full Code Here

    public PDType3CharProc getCharProc(int code)
    {
        String name = getEncoding().getName(code);
        if (!name.equals(".notdef"))
        {
            COSStream stream;
            stream = (COSStream)getCharProcs().getDictionaryObject(COSName.getPDFName(name));
            if (stream == null)
            {
                return null;
            }
View Full Code Here

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

TOP

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

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.