I am trying to print rich text content in pdf using itextSharp library with version 5.5.8.0. But I am I am printing that rich text, it will print only normal string without any style effect or html tags.
Here is my web view that contain rich text
But while printing in pdf using iTexhSharp, it will print like rich text but each html element it will start printing with new line, as like below image
Here is the code, that I am using to print rich text in pdf:
ElementList elements = XMLWorkerHelper.ParseToElementList(descriptionData, "");
PdfPCell cell = new PdfPCell();
foreach(var ele in elements) {
cellDescriptionData.AddElement(ele);
}
tableThirdBlock.AddCell(cellDescriptionData);
Here the "descriptionData" field will contain the html string.
I want to be print the same in pdf as available in web view.
Here is the actual HTML string, which is generated dynamically. So the html string will be dynamic with dynamic css and text.
" <b style="font-family: Arial, Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; color: rgb(204, 255, 255); background-color: rgb(51, 102, 255);">zzz </b><div style="font-family: Arial, Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"><b style="color: rgb(204, 255, 255); background-color: rgb(51, 102, 255);"><br /></b></div><div><b style="font-family: Arial, Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; color: rgb(204, 255, 255); background-color: rgb(51, 102, 255);">Test </b> <span style="color: rgb(255, 0, 0);"> <span style="font-weight: bold;">Description</span> </span><span style="color: rgb(153, 51, 153); font-style: italic;">Other Color</span></div> ".
Is anything wrong, that I am missing ?
Please help me to print rich text with all effect and styles in pdf.
Thanks