Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSName


        if( fontEncoding == null )
        {
            COSBase encoding = font.getDictionaryObject( COSName.ENCODING );
            if( encoding == null )
            {
                COSName baseFont = (COSName)font.getDictionaryObject( COSName.BASE_FONT );
                if( baseFont != null )
                {
                    if( afmResources.get( baseFont ) != null )
                    {
                        fontEncoding = new AFMEncoding( getAFM( baseFont ) );
View Full Code Here


        {

            Iterator iterKeys = sourceDict.keyList().iterator();
            while (iterKeys.hasNext())
            {
                COSName key = (COSName) iterKeys.next();
                COSName mappedKey = (COSName) objectNameMap.get(key.getName());
                if (mappedKey == null)
                {
                    // object not needet
                    if (log.isDebugEnabled())
                    {
View Full Code Here

        for (int sourceDictIdx = 0; sourceDict != null && sourceDictIdx<sourceDict.size(); sourceDictIdx++)
        {
            COSBase key = (COSBase) sourceDict.get(sourceDictIdx);
            if (key instanceof COSName)
            {
                COSName keyname = (COSName) key;

                boolean bFound = false;
                for (int destDictIdx = 0; destDictIdx<destDict.size(); destDictIdx++)
                {
                    COSBase destkey = (COSBase) destDict.get(destDictIdx);
                    if (destkey instanceof COSName)
                    {
                        COSName destkeyname = (COSName) destkey;
                        if (destkeyname.equals(keyname))
                        {
                            bFound = true;
                            break;
                        }
                    }
View Full Code Here

     *
     * @throws IOException If there is no name for the code.
     */
    public COSName getName( int code ) throws IOException
    {
        COSName name = (COSName)codeToName.get( new Integer( code ) );
        if( name == null )
        {
            //lets be forgiving for now
            name = COSName.getPDFName( "space" );
            //throw new IOException( getClass().getName() +
View Full Code Here

     *
     * @throws IOException If there is no name for the character.
     */
    public COSName getNameFromCharacter( char c ) throws IOException
    {
        COSName name = (COSName)CHARACTER_TO_NAME.get( "" + c );
        if( name == null )
        {
            throw new IOException( "No name for character '" + c + "'" );
        }
        return name;
View Full Code Here

    {
        encoding = fontEncoding;

        //first set up the base encoding
        Encoding baseEncoding = new WinAnsiEncoding();
        COSName baseEncodingName = (COSName)encoding.getDictionaryObject( COSName.BASE_ENCODING );
        if( baseEncodingName != null )
        {
            EncodingManager manager = new EncodingManager();
            baseEncoding = manager.getEncoding( baseEncodingName );
        }
        nameToCode.putAll( baseEncoding.nameToCode );
        codeToName.putAll( baseEncoding.codeToName );


        //now replace with the differences.
        COSArray differences = (COSArray)encoding.getDictionaryObject( COSName.DIFFERENCES );
        int currentIndex = -1;
        for( int i=0; differences != null && i<differences.size(); i++ )
        {
            COSBase next = differences.get( i );
            if( next instanceof COSNumber )
            {
                currentIndex = (int)((COSNumber)next).intValue();
            }
            else if( next instanceof COSName )
            {
                COSName name = (COSName)next;
                addCharacterEncoding( currentIndex++, name );
            }
        }
    }
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)
                {
                    // this is purely defensive, if entry is set to null instead of removed
                    name.accept(this);
                    getStandardOutput().write(SPACE);
                    //a quick fix until parsing is fixed
                    if( value instanceof org.pdfbox.cos.COSObject )
                    {
                        value = ((org.pdfbox.cos.COSObject)value).getObject();
View Full Code Here

     */
    public PDDocumentInformation getDocumentInformation()
    {
        if( documentInformation == null )
        {
            COSName infoName = COSName.getPDFName( "Info" );
            COSDictionary trailer = document.getTrailer();
            COSDictionary infoDic = (COSDictionary)trailer.getDictionaryObject( infoName );
            if( infoDic == null )
            {
                infoDic = new COSDictionary();
View Full Code Here

            textMatrix = textLineMatrix.copy();
        }
        else if( operation.equals( "Tf" ) )
        {
            //set font and size
            COSName fontName = (COSName)arguments.get( 0 );
            currentFontSize = (COSNumber)arguments.get( 1 );

            if (log.isDebugEnabled())
            {
                log.debug("<Tf font=\"" + fontName.getName() + "\" size=\"" + currentFontSize.floatValue() + "\">");
            }

            //old way
            //currentFont = (COSObject)stream.getDictionaryObject( fontName );
            //if( currentFont == null )
View Full Code Here

     * @return The value if it exists or null.
     */
    private String getNameItem( COSName key )
    {
        String retval = null;
        COSName value = (COSName)info.getDictionaryObject( key );
        if( value != null )
        {
            retval = value.getName();
        }
        return retval;
    }
View Full Code Here

TOP

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