Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSString


     * @return The font family.
     */
    public String getFontFamily()
    {
        String retval = null;
        COSString name = (COSString)dic.getDictionaryObject( COSName.getPDFName( "FontFamily" ) );
        if( name != null )
        {
            retval = name.getString();
        }
        return retval;
    }
View Full Code Here


     *
     * @param fontFamily The font family.
     */
    public void setFontFamily( String fontFamily )
    {
        COSString name = null;
        if( fontFamily != null )
        {
            name = new COSString( fontFamily );
        }
        dic.setItem( COSName.getPDFName( "FontFamily" ), name );
    }
View Full Code Here

     * @return The character set value.
     */
    public String getCharSet()
    {
        String retval = null;
        COSString name = (COSString)dic.getDictionaryObject( COSName.getPDFName( "CharSet" ) );
        if( name != null )
        {
            retval = name.getString();
        }
        return retval;
    }
View Full Code Here

     *
     * @param charSet The new character set for the font.
     */
    public void setCharacterSet( String charSet )
    {
        COSString name = null;
        if( charSet != null )
        {
            name = new COSString( charSet );
        }
        dic.setItem( COSName.getPDFName( "CharSet" ), name );
    }
View Full Code Here

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

                        for( int i=0; i<tokens.size(); i++ )
                        {
                            if( tokens.get( i ) instanceof COSString )
                            {
                                foundString = true;
                                COSString drawnString =((COSString)tokens.get(i));
                                drawnString.reset();
                                drawnString.append( apValue.getBytes() );
                            }
                        }
                        int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" ));
                        tokens.set( setFontIndex-1, new COSFloat( fontSize ) );
                        if( foundString )
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() ), null );
                streamParser.parse();
                tokens = streamParser.getTokens();
            }
View Full Code Here

     *
     * @throws IOException If there is an error creating the appearance stream.
     */
    public void setValue(String value) throws IOException
    {
        COSString fieldValue = new COSString(value);
        getDictionary().setItem( COSName.getPDFName( "V" ), fieldValue );
        getDictionary().setItem( COSName.getPDFName( "DV" ), fieldValue );
    }
View Full Code Here

                        //strings in a PDF
                        if( op.getOperation().equals( "Tj" ) )
                        {
                            //Tj takes one operator and that is the string
                            //to display so lets update that operator
                            COSString previous = (COSString)tokens.get( j-1 );
                            String string = previous.getString();
                            string = string.replaceFirst( strToFind, message );
                            previous.reset();
                            previous.append( string.getBytes() );
                        }
                        else if( op.getOperation().equals( "TJ" ) )
                        {
                            COSArray previous = (COSArray)tokens.get( j-1 );
                            for( int k=0; k<previous.size(); k++ )
                            {
                                Object arrElement = previous.getObject( k );
                                if( arrElement instanceof COSString )
                                {
                                    COSString cosString = (COSString)arrElement;
                                    String string = cosString.getString();
                                    string = string.replaceFirst( strToFind, message );
                                    cosString.reset();
                                    cosString.append( string.getBytes() );                                   
                                }
                            }
                        }
                    }
                }
View Full Code Here

            output.write( "<f href=\"" + fs.getFile() + "\" />\n" );
        }
        COSArray ids = this.getID();
        if( ids != null )
        {
            COSString original = (COSString)ids.getObject( 0 );
            COSString modified = (COSString)ids.getObject( 1 );
            output.write( "<ids original=\"" + original.getHexString() + "\" " );
            output.write( "modified=\"" + modified.getHexString() + "\" />\n");
        }
        List fields = getFields();
        if( fields != null && fields.size() > 0 )
        {
            output.write( "<fields>\n" );
View Full Code Here

TOP

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