pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhanushka Manjula <dhanushkamanj...@gmail.com>
Subject Editing PDF page doesn't work
Date Wed, 08 May 2013 09:26:08 GMT
I'm going to edit a pdf file and with Asian characters but it doesn't work.
When all characters are in English letters, The operation come as "Tj" and
all fine...!
but When the character are not in English , The operation coming out from
the pdf is "TJ"
and it goes thru the bellow code and I can see the replacement of the
string as well. (Hello to XXXXX)
but output pdf is exactly similar to the input pdf.. that means replace
part didn't apply
Can anyone point me the right direction please
the sample pdf is also attached..

                 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(
"Hello", "XXXXX" );

                                            cosString.reset();
                                            cosString.append(
string.getBytes("ISO-8859-1") );

                                        }
                                    }
                                }

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message