Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSName


     *
     * @throws IOException If there is an error processing this operator.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        COSName name = (COSName) arguments.get( 0 );

        Map xobjects = context.getXObjects();
        PDXObject xobject = (PDXObject) xobjects.get(name.getName());

        if(xobject instanceof PDXObjectForm)
        {
            PDXObjectForm form = (PDXObjectForm)xobject;
            COSStream invoke = (COSStream)form.getCOSObject();
View Full Code Here


        Map actuals = new HashMap();
        Map 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

            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

            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

        {
            getStandardOutput().write(DICT_OPEN);
            getStandardOutput().writeEOL();
            for (Iterator i = obj.keyList().iterator(); i.hasNext();)
            {
                COSName name = (COSName) i.next();
                COSBase value = obj.getItem(name);
                if (value != null)
                {
                    name.accept(this);
                    getStandardOutput().write(SPACE);
                    if( value instanceof COSDictionary )
                    {
                        addObjectToWrite( value );
                        writeReference( value );
View Full Code Here

     */
    public static PDFont createFont( COSDictionary dic ) throws IOException
    {
        PDFont retval = null;

        COSName type = (COSName)dic.getDictionaryObject( COSName.TYPE );
        if( !type.equals( COSName.FONT ) )
        {
            throw new IOException( "Cannot create font if /Type is not /Font.  Actual=" +type );
        }

        COSName subType = (COSName)dic.getDictionaryObject( COSName.SUBTYPE );
        if( subType.equals( COSName.TYPE1) )
        {
            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 );
                    }
                }
            }
        }
        else if( subType.equals( COSName.MM_TYPE1 ) )
        {
            retval = new PDMMType1Font( dic );
        }
        else if( subType.equals( COSName.TRUE_TYPE ) )
        {
            retval = new PDTrueTypeFont( dic );
        }
        else if( subType.equals( COSName.TYPE3 ) )
        {
            retval = new PDType3Font( dic );
        }
        else if( subType.equals( COSName.TYPE0 ) )
        {
            retval = new PDType0Font( dic );
        }
        else if( subType.equals( COSName.CID_FONT_TYPE0 ) )
        {
            retval = new PDCIDFontType0Font( dic );
        }
        else if( subType.equals( COSName.CID_FONT_TYPE2 ) )
        {
            retval = new PDCIDFontType2Font( dic );
        }
        else
        {
View Full Code Here

    {
        Map<Integer,String> result = new LinkedHashMap<Integer,String>();
        COSBase encoding = super.font.getDictionaryObject(COSName.ENCODING);
        if( encoding instanceof COSName )
        {
            COSName name = (COSName)encoding;
            result.putAll(loadEncoding(name));
        }
        else if( encoding instanceof COSDictionary )
        {
            COSDictionary encodingDic = (COSDictionary)encoding;
            COSName baseName = (COSName)encodingDic.getDictionaryObject(COSName.BASE_ENCODING);
            if( baseName != null )
            {
                result.putAll(loadEncoding(baseName));
            }
            COSArray differences = (COSArray)encodingDic.getDictionaryObject(COSName.DIFFERENCES);
View Full Code Here

            }
            else
            {
                if( element instanceof COSName )
                {
                    COSName name = (COSName)element;
                    result.put(code, name.getName());
                    code = Integer.valueOf(code.intValue() + 1);
                }
            }
        }
        return result;
View Full Code Here

    {
        PageDrawer drawer = (PageDrawer)context;
        PDPage page = drawer.getPage();
        Dimension pageSize = drawer.getPageSize();
        Graphics2D graphics = drawer.getGraphics();
        COSName objectName = (COSName)arguments.get( 0 );
        Map xobjects = drawer.getResources().getXObjects();
        PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() );
        if( xobject instanceof PDXObjectImage )
        {
            PDXObjectImage image = (PDXObjectImage)xobject;
            try
            {
View Full Code Here

        float retval = 0;
        FontMetric metric = getAFM();
        if( metric != null )
        {
            Encoding encoding = getEncoding();
            COSName characterName = encoding.getName( code );
            retval = metric.getCharacterWidth( characterName.getName() );
        }
        return retval;
    }
View Full Code Here

TOP

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

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.