我可以更改表格标题的颜色,但无法更改字体大小
StyleSheet css = new StyleSheet();
css.LoadTagStyle(HtmlTags.TH, HtmlTags.FONTSIZE, "5");
css.LoadTagStyle(HtmlTags.TH, HtmlTags.COLOR, "Red");
var response = context.HttpContext.Response;
using (var pdfStream = new MemoryStream())
using (var pdfDoc = new Document())
using (var pdfWriter = PdfWriter.GetInstance(pdfDoc, pdfStream)) {
pdfDoc.Open();
using (var htmlRdr = new StringReader(writer.ToString())) {
var parsed = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(htmlRdr, css);
foreach (var parsedElement in parsed) {
pdfDoc.Add(parsedElement);
}
}
pdfDoc.Close();