I am trying to create a pdf with pdf stamper which is working fine. I have created a big multiline textbox in the template, where I need to print a huge string. To the string I need to make few string in bold and other in normal font. I tried in many ways, but could not get the font in bold.I need to make the Heading string in bold.
string pdfTemplatePath = Server.MapPath("PDF/" + group + "/template.pdf");
PdfReader pdfReader = new PdfReader(pdfTemplatePath);
MemoryStream myMemoryStream = new MemoryStream();
PdfStamper pdfStamper = new PdfStamper(pdfReader, myMemoryStream);
AcroFields pdfFormFields = pdfStamper.AcroFields;
pdfFormFields.SetField("Name", "abc");
string a = "Some text";
string b = "Some large text";
StringBuilder sb = new StringBuilder();
sb.Append("Heading1");
sb.Append(a);
sb.Append("Heading2");
sb.Append(b);
String htmlText = sb.ToString();
List<IElement> htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlText), null);
for (int k = 0; k < htmlarraylist.Count; k++)
{
phrase.Add((IElement)htmlarraylist[k]);
}