点击按钮我需要阅读
HTML文件并将其转换为PDF. PDF生成没有任何问题.但是,转换为PDF时,表中列的宽度均匀分布.但我需要我桌子的第一列占据桌子总面积的70%(540)
我怎样才能做到这一点?
Template.html:
Test Specification | GST | Service | Amount |
单击按钮将HTML转换为PDF:
protected void Button1_Click(object sender, EventArgs e)
{
String htmlText = System.IO.File.ReadAllText(Request.PhysicalApplicationPath + "\\Template.htm");
Document document = new Document();
PdfWriter.GetInstance(document, new FileStream(Request.PhysicalApplicationPath + DateTime.Now.ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("HHmmss tt") + ".pdf", FileMode.Create));
document.Open();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
hw.Parse(new StringReader(HTML));
document.Close();
StringBuilder sb = new StringBuilder();
sb.Append(HTML);
}