Hi,
While using IText.AddRichContent method, the line breaks are not maintained in the pdf file generated. In addition if using the left hand angle bracket < it is causing it to think it is a HTML open tag and is cutting off any text after that point.
So if the actual content is :
HiThis is a new Line.<Thank you> for using the service.<i>Another New Line.</i>
The pdf file will have the content printed as :
Hi This is a new Line. for using the service. Another New Line.
The documentation mentions AddRichContent method only supports few tags. Is there any workaround these issues.
Hello,
Thank you for contacting Infragistics!
I have some questions concerning this matter. Have you tried using escape sequences for those characters? How are you doing the new line/line breaks? What version are you using?
Hi Mike,
The new line comes as \r\n in the text. Using escape sequence did not help, but replacing "\r\n" with "<br/> maintained the line breaks. But the issue with using the left hand angle bracket in the text is cutting off any text after that point thinking its a HTML open tag.
I am using version 13.2.20132.2023.
Thank you for the update. I have done some further looking into this matter. You have to use the specific html escape characters mentioned in the following link:
http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php?PHPSESSID=8cbbddde9a9c9825467546f1c98fe119
For example:
AddRichContent("Hi,<br/>This is a new Line.<br/><Thank you> for using the service.<br/> <i>Another New Line.</i>");
Which will then print out:
Hi,This is a new Line.<Thank you> for using the service.Another New Line.
Thanks for looking into this Mike.
Just one question, shouldn't the AddRichContent method just print the tags as it is if they are not supported instead of not printing it at all. The issue with using escape characters is I need to still display the formatted data if the tags are valid. So this means i will have to parse through the string and use escape characters only on strings that are not HTML tags.
Thank you for the update. I am currently discussing this matter further with the team that is responsible for our document engine. Once I have more information I will update you concerning this matter. Note with the holiday this week it may take a few days.
Hello Thejaswi Rao,
I am assisting with this issue as Mike P. is out of the office today.
The response from our developer is that is how the HTML/XML is detected in most cases, using the <> tags and not necessarily the contents of the <>. The recommended solution is to parse the data and escape the characters where you want to actually render them.
You could also submit more accurate HTML detection as a new Product Idea. You can suggest new product ideas for future versions (or vote for existing ones) at http://ideas.infragistics.com.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.- Notifications whenever new information regarding your idea becomes available.- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.- Allow you to shape the future of our products by requesting new controls and products altogether.- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)3. Add your product idea and be sure to be specific and provide as much detail as possible. • Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing! • Include a link to this thread in your idea so product management will be able to look back at this case.
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.