I am currently working on ASP.Net with ItestSharp and made a pdf but the problem is for the setting different color on the pdf. In the below code every new background-color rgb(r,g,b) i have to replace with bgcolor with hash code. I want to search the RGB color text from the text pass and convert into hash code. Searching is Imp. I want to find from the string HtmlText plzzzzz help me guys..
public void OthersTable(Document document, string HtmlText))
{
Font fontBold = new Font(f_garamondBold, 11, Font.NORMAL, new Color(0x00, 0x00, 0x00));
HtmlText = HtmlText.Replace("<p>", "");
HtmlText = HtmlText.Replace("</p>", "<br>");
HtmlText = HtmlText.Replace("\"", "'");
HtmlText = HtmlText.Replace("style='background-color:rgb(191, 191, 191);", " bgcolor='#BFBFBF' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(196, 189, 151);", " bgcolor='#C4BD97' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(217, 217, 217);", " bgcolor='#D9D9D9' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(196,215,155);", "bgcolor='#C4D79B' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(230,184,183);", "bgcolor='#E6B8B7' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(216,228,188);", "bgcolor='#D8E4BC' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(242,220,219);", "bgcolor='#F2DCDB' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(227,151,148);", "bgcolor='#E39794' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(79, 98, 49);", "bgcolor='#4F6231' style='");
HtmlText = HtmlText.Replace("style='background-color:rgb(0, 176, 80);", "bgcolor='#00B050' style='");
HtmlText = "<body>" + HtmlText + "</body>";
iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
var parsedHtmlElements = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(HtmlText), css);
}