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

Free Support Forum - aspose.com

FontStyle in TextFragment instance

Hey!


I am looking for text wrapping in TextFragment instance, how can i wrap the text in TextFragment instance.

Another issue i am facing in TextFragment is, i am not able to add Bold and Italic style together.
Please let me know how can i apply both styles together.

Thanks,
Brijen Patel

Hi Brijen,


Thanks for your inquiry. While testing with Aspose.Pdf for .NET 7.9, I’m unable to found any issue to add bold and italic style simultaneously. Please download and try latest version of Aspose.Pdf dll.

Furthermore, can you please share some more detail about your text wrapping requirement and your sample code/document here? So we will look into it and suggest you solution accordingly.

Best Regards,

Hi Tilal,

Thanks for your reply.

I have doanloaded Aspose.Pdf for .Net 7.9, but still could not find bold and italic together.
Here is the code:

//Create text fragment
TextFragment textFragment = new TextFragment("Brijen Patel");
textFragment.Position = new Position(50, 700);
//Set text properties
textFragment.TextState.FontSize = 12;
textFragment.TextState.FontStyle = FontStyles.Italic;
textFragment.TextState.FontStyle = FontStyles.Bold;

TextBuilder textBuilder = new TextBuilder(pdfPage);
//Append the text fragment to the PDF page
textBuilder.AppendText(textFragment);

Let me know if i miss anything here.

For TextWrapping, actually, i would like to add label which has max length of 250 characters, now if the text is not fit into the width then i would i like to wrap the text of the label.

Thanks and Regards,
Brijen Patelv

Hi Brijen,

Thanks for providing sample code. I've observed the font style issue on my side and logged the issue in our bug tracking system for further investigation and resolution as PDFNEWNET-35165.


Furthermore, I'm afraid text wrapping feature is not available in TextFragment class. So I've also logged a ticket for further investigation and resoultion for the same as PDFNEWNET-35166. I've also linked your request to these issues and you will be notified via this thread as soon as these are resolved.


Sorry for the inconvenience faced..

Best Regards,

Thanks for the update Tilal.


I will wait till next update.

Thanks & Regards,
Brijen Patel

Hi Tilal,


Any update on above two tickets (PDFNEWNET-35165, PDFNEWNET-35166)?

Regards,
Brijen Patel

Hi Brijen,


Sorry for the delayed response. Please to set font styles simultaneously use “|” operator, as following. hopefully it will solve the styling issue. And I’m afraid your other reported issue is still not resolve. However, I’ve requested the development team to share ETA for text wrapping feature in TextFragment class. As soon as I get a feedback I’ll update you via this forum thread.


textFragment.TextState.FontStyle = FontStyles.Bold | FontStyles.Italic;


Thanks for your patience and understanding.


Best Regards,

Hi Tilal,


Thanks for the update!
I am now able to apply both font styles i.e. Bold and Italic simultaneously.

Regards,
Brijen Patel

Hi Brijen,


Thanks for your feedback. Its good to know that you have manged to achieve your desired font style. Furthermore regarding text wrapping issue PDFNEWNET-35166, we will update you via this forum thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Brijen,


Thanks for your patience. The TextFragment doesn’t support text wrapping. To use text wrapping the TextParagraph class must be used. Please check following code snippet for text wrapping.

Document doc = new Document(“input.pdf”);

Page page = (Page)doc.Pages[1];

TextBuilder builder = new TextBuilder(page);

// create text paragraph
TextParagraph paragraph = new TextParagraph();

paragraph.Rectangle = new Aspose.Pdf.Rectangle(100, 600, 500, 700);

paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;

paragraph.AppendLine(“the quick brown fox jumps over the lazy dog”);
paragraph.AppendLine(“line2”);
paragraph.AppendLine(“line3”);

// add paragraph
builder.AppendParagraph(paragraph);

doc.Save(“output.pdf”);

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35165) have been fixed in Aspose.Pdf for .NET 8.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as PDFNEWNET-35166) have been fixed in Aspose.Pdf for .NET 8.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


Thanks for the update but i am unable to find any property to wrap the text in text fragment class.
Could you please suggest me how to wrap text.

Thanks & Regards,
Brijen Patel

Hi Brijen,


Thanks for your inquiry. As updated above, you must use TextParagraph class as TextFragment doesn’t support text wrapping. please check details and sample code snippet here here,

Please feel free to contact us for any further assistance.

Best Regards,
Hi Tilal,

As per the update from Aspose Notifier on dated 06-07-2013, 3:22 PM, the issue PDFNEWNET-35166 have been fixed in Aspose.Pdf for .NET 8.1.0.
Correct me if i am wrong.

Regards,
Brijen Patel

Hi Brijen,


Thanks for your inquiry. As a SOP every issue is linked with some Version so you get a notification for the resolution in Aspose.Pdf for .NET 8.1.0. If you see the tagged issue status in top left column of this thread you will notice the resolution is code snippet provided. Hopefully it will clear up the confusion.

Please let me know if I can provide any further assistance.

Best Regards,

Hi,
I am using the aspose java version in one of my component in which i am passing the binary data as input and and converting it into pdf but problem is i want to change the font size to smaller because my text got wrapped to next line and due to this alignment is not proper in my pdf. It would be great if you share the sample code through which i can adjust the font size according to my choice.
Regards,
Manish Jawla

@manish_jawla

Thanks for contacting support.

Would you please share the sample code snippet along with sample input/output file(s), so that we can test the scenario in our environment and address it accordingly. Also, we will really appreciate if you can please share the JDK version which you are using at your side.