How can i set background color of text if i am using addhtml
method only. as add HTML method is only supporting number of HTML tags is there any workaround. This is what i have done
theDoc.Rect.String = "35 725 560 765";//35 745 560 765
int theFont1 = theDoc.AddFont("Arial", LanguageType.Latin, false);
theDoc.FontSize = 14;
theID = theDoc.AddHtml("<p align='center'><font pid=" + theFont1.ToString() + " font-weight='bold'>" + doc_ref + " - " + doc_name + "</font></p>");
If you truly need full featured HTML, you will need to use AddImageURL or AddImageHTML, which leverage either the Internet Explorer HTML engine or the Gecko engine. Unfortunately, they are limited to system installed fonts, and RGB colors -- you cannot add fonts using a filesystem reference, or use CMYK or spot colors.
For the specific problem of setting background color, add a colored rectangle first, then add the text:
theDoc.Rect.String = "35 725 560 765";//35 745 560 765
theDoc.Color.String = "0 100 100 0"; // 100% Magenta + 100% Yellow = CMYK red for background
int bgID = theDoc.fillRect();
theDoc.Color.String = "0 0 0 100"; // black text
int theFont1 = theDoc.AddFont("Arial", LanguageType.Latin, false);
theDoc.FontSize = 14;
int textID = theDoc.AddHtml("<p align='center'><font pid=" + theFont1.ToString()
+ " font-weight='bold'>" + doc_ref + " - " + doc_name + "</font></p>");