var htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), styles);
document.Open();
BaseFont Vn_Helvetica = BaseFont.CreateFont(@\"C:\\Windows\\Fonts\\aria
i have try set font family in pdf template. and show the following error also
'BaseFont' does not contain a definition for 'Cambria'
please suggest me...thanks
public void abcd()
{
try
{
string UniqueNumber = Request.QueryString["UniqueNumber"];
string strFileName = UniqueNumber;
string strFileExtension = ".pdf";
string strContentType = FileManager.FileContentType_application_pdf;
string strExportData = string.Empty;
Document pdfDoc = new Document();
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
var output = new MemoryStream();
BaseFont bfTimes = BaseFont.CreateFont(BaseFont.Cambria, BaseFont.CP1252, false);
//Font ChronicleFont = new Font(bfTimes, 26f);
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
StringReader sr;
sr = new StringReader(Convert.ToString(ExportData.UserDetails(UniqueNumber)));
PdfWriter.GetInstance(pdfDoc, output);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
strFileName = strFileName.Replace(" - ", "-").Replace(" ", "-").Replace("--", "-");
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}{1}", strFileName, strFileExtension));
Response.ContentType = strContentType;
Response.Charset = "";
Response.BinaryWrite(output.ToArray());
Response.Flush();
Response.End();
}
catch (Exception ex)
{
//
}
}
Please try by setting font to the PdfPTable.DefaultCell property
in you foreach loop
Example:
t.DefaultCell.Phrase = new Phrase() { Font = fontNormal };