Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSString


            {
                name = (COSName)baseFont;
            }
            else if( baseFont instanceof COSString )
            {
                COSString string = (COSString)baseFont;
                name = COSName.getPDFName( string.getString() );
            }
            if( name != null )
            {
              afm = afmObjects.get( name );
                if( afm == null )
View Full Code Here


    {
        PDColorSpace baseColor = getBaseColorSpace();
        int numberOfComponents = baseColor.getNumberOfComponents();
        byte[] data = getLookupData();
        data[lookupIndex*numberOfComponents + componentNumber] = (byte)color;
        COSString string = new COSString( data );
        array.set( 3, string );
    }
View Full Code Here

     *
     * @return The DA element
     */
    private COSString getDefaultAppearance()
    {
        COSString dap = parent.getDefaultAppearance();
        if (dap == null)
        {
            COSArray kids = (COSArray) parent.getDictionary().getDictionaryObject(COSName.KIDS);
            if (kids != null && kids.size() > 0)
            {
View Full Code Here

        // add the value as hex string to deal with non ISO-8859-1 data values
        if (!isMultiLineValue(value) || stringWidth > borderEdge.getWidth() - paddingLeft -
                paddingRight)
        {
            printWriter.println("<" + new COSString(value).getHexString() + "> Tj");
        }
        else
        {
            String[] paragraphs = value.split("\n");
            for (int i = 0; i < paragraphs.length; i++)
            {
                boolean lastLine = i == (paragraphs.length - 1);
                String endingTag = lastLine ? "> Tj\n" : "> Tj 0 -13 Td";
                printWriter.print("<" + new COSString(paragraphs[i]).getHexString() + endingTag);
            }
        }
        printWriter.println("ET");
        printWriter.flush();
    }
View Full Code Here

            {
                streamResources = new PDResources();
                appearanceStream.setResources(streamResources);
            }

            COSString da = getDefaultAppearance();
            if (da != null)
            {
                String data = da.getString();
                PDFStreamParser streamParser = new PDFStreamParser(new ByteArrayInputStream(
                        data.getBytes("ISO-8859-1")));
                streamParser.parse();
                tokens = streamParser.getTokens();
            }
View Full Code Here

                }
                String[] stringValues = (String[])value;
                COSArray stringArray = new COSArray();
                for (int i =0; i<stringValues.length;i++)
                {
                    stringArray.add(new COSString(stringValues[i]));
                }
                getDictionary().setItem(COSName.V, stringArray);
            }
        }
        else
View Full Code Here

        {
            COSBase option = options.getObject(i);
            if (option instanceof COSArray)
            {
                COSArray keyValuePair = (COSArray) option;
                COSString key = (COSString) keyValuePair.getObject(0);
                COSString value = (COSString) keyValuePair.getObject(1);
                if (optionValue.equals(key.getString()) || optionValue.equals(value.getString()))
                {
                    indexSelected = i;
                }
            }
            else
            {
                COSString value = (COSString) option;
                if (optionValue.equals(value.getString()))
                {
                    indexSelected = i;
                }
            }
        }
View Full Code Here

            parentDict = null;
        }
        //string is a special case because we can't subclass to be COSObjectable
        if( o instanceof String )
        {
            array.add( new COSString( (String)o ) );
        }
        else if( o instanceof DualCOSObjectable )
        {
            DualCOSObjectable dual = (DualCOSObjectable)o;
            array.add( dual.getFirstCOSObject() );
View Full Code Here

    public static COSArray convertStringListToCOSStringCOSArray( List<String> strings )
    {
        COSArray retval = new COSArray();
        for (String string : strings)
        {
            retval.add(new COSString(string));
        }
        return retval;
    }
View Full Code Here

                while( iter.hasNext() )
                {
                    Object next = iter.next();
                    if( next instanceof String )
                    {
                        array.add( new COSString( (String)next ) );
                    }
                    else if( next instanceof Integer || next instanceof Long )
                    {
                        array.add( COSInteger.get( ((Number)next).longValue() ) );
                    }
View Full Code Here

TOP

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

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.