We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextSegment issues

Hi,





I am building a text fragment using multiple text segments as I want to style the segments differently. What I have noticed is TextFragment preference is overwriting TextSegment preference. It should be other way around. For example

TextFragment textFragment = new TextFragment("Normal black text ");

textFragment .getTextState().setFontStyle(FontStyles.Regular);



TextSegment seg1= new TextSegment("Bold black text ");



seg1.getTextState().setFontStyle(FontStyles.Bold);



seg1.getTextState().setForegroundColor(com.aspose.pdf.Color.getRed());



page.getParagraphs().add(textFragment);



Here seg1 is not displayed in red color.



One more example:

TextFragment textFragment = new TextFragment("Normal black text ");



TextSegment seg1= new TextSegment(“Bold black text \r\n blue text”);



seg1.getTextState().setFontStyle(FontStyles.Bold);



seg1.getTextState().setForegroundColor(com.aspose.pdf.Color.getRed());



page.getParagraphs().add(textFragment);



Here also seg1 is not displayed in red color as segment content has new line character.



Can you please look into them.



Thanks

Mamatha

Hi Mamatha,


Thanks for using our API’s.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFJAVA-36067 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFJAVA-36067) have been fixed in Aspose.PDF for Java 20.7.