Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
var styles = new iTextSharp.text.html.simpleparser.StyleSheet();
                     styles.LoadStyle("Lastname", "size", "50pt");
                     hTextWriter.Write("<div class=\"Lastname\">");


                     hTextWriter.Write("<p>Kurac</p>");
                     hTextWriter.Write("</div>");




                     String strHtml1 = sw.ToString();

                     var hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
                     hw.SetStyleSheet(styles);
                     hw.Parse(new StringReader(strHtml1));
                     document.Close();
Posted
Updated 22-Apr-13 23:08pm
v3

1 solution

Hi,

You first need to load stylesheet that contains all your css class.

Please check this[^] discussion.

Best luck.
 
Share this answer
 
Comments
Kurac1 23-Apr-13 4:38am    
i have tried it wont work
AmitGajjar 23-Apr-13 4:40am    
can you post your updated code ?
Kurac1 23-Apr-13 4:41am    
i have loaded my stylesheet here styles.LoadTagStyle("Lastname", "size", "50pt");
AmitGajjar 23-Apr-13 5:01am    
try with below,

styles.LoadStyle("Lastname", "size", "15pt");
Kurac1 23-Apr-13 5:07am    
Thanks i got i to work by my one , but how to i add css style now, i dont only want to use html style i want to use css also??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900