Sep 26, 2017 02:30 AM|Velen|LINK
I need to export it to pdf format using itextsharp library. However i find that itextsharp is not able to convert the inline styles of the divs and some text is totally ignored. It doesn't give any borders as well. I feel only the table structure is being supported
by itextsharp. I dont want to go back to converting my divs to tables tr/tds.
According to your description, I suggest you could try the following code to add border to your divs:
StyleSheet css = new StyleSheet();
css.LoadTagStyle(HtmlTags.DIV, HtmlTags.BORDER, "1");
And you could add some style via class name like below:
StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();
styles.LoadTagStyle(".redBigText", "font-size", "50px");
styles.LoadTagStyle(".redBigText", "color", "#ff0000");
var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(mainContents), styles);
If you have any other questions, please feel free to contact me any time.