Hi Team,

I have one issue with font color.

My requirement is , I have PDField and need to display text with limited size 
with black color and once reach the length of the characters need to display 
overflow text with different color .

I am trying with below code but its overriding with blue color font for all the 
text.

int normalTextSize=ucc1_opt.substring(0,84).length();
int overFlowTextSize=ucc1_opt.substring(84,ucc1_opt.length()).length();

PDField ucc1_Optional_nonColor=null;
PDField ucc1_Optional_Color=null;


                                                                
if(normalTextSize>0){

                                                                                
ucc1_Optional_nonColor = form.getField("8");

                                                                                
nonColorText=ucc1_opt.substring(0,84);  //get limited text 0 to 84

                                                                                
ucc1_Optional_nonColor.setValue(nonColorText);

                                                                                
((PDVariableText) 
ucc1_Optional_nonColor).setDefaultAppearance(Constants.FONT_BLACK);

                                                                }
                                                                
if(overFlowTextSize>0){

                                                                                
ucc1_Optional_Color=form.getField("8");

                                                                                
colorText=ucc1_opt.substring(84,ucc1_opt.length());   //For over flow text

                                                                                
ucc1_Optional_Color.setValue(colorText);

                                                                                
((PDVariableText) 
ucc1_Optional_Color).setDefaultAppearance(Constants.FONT_BLUE);

                                                                }


Could you please suggest/help is it possible to set 2 different font colors for 
single text field text in pdfbox. (partial text colors)

Thank you in advance for your help.

Regards,
Santhosh


******************************************************************************************
This message may contain confidential or proprietary information intended only 
for the use of the
addressee(s) named above or may contain information that is legally privileged. 
If you are
not the intended addressee, or the person responsible for delivering it to the 
intended addressee,
you are hereby notified that reading, disseminating, distributing or copying 
this message is strictly
prohibited. If you have received this message by mistake, please immediately 
notify us by
replying to the message and delete the original message and any copies 
immediately thereafter.

If you received this email as a commercial message and would like to opt out of 
future commercial
messages, please let us know and we will remove you from our distribution list.

Thank you.~
******************************************************************************************
FAFLD

Reply via email to