【发布时间】:2012-02-18 09:26:26
【问题描述】:
我正在用 C# 编写一个 PDF 文件,如下所示:
Response.ContentType = "application/vnd.pdf";
Response.AddHeader("content-disposition", "attachment;filename=test.pdf");
Response.Write("<table border='1px'>");
/* Print Headers */
Response.Write("<tr>");
Response.Write("<th colspan='" + colspan + "'style='background-color:SlateGray;font-size:16;height:25;color:white;'><b>List of Candidates "</b></th>");
Response.Write("</tr>");
Response.Write("<tr>");
当我保存文件并打开它时,它会抛出一个异常,即文件不支持文件类型..或文件已损坏。
【问题讨论】:
-
您正在编写 tr,td 并希望将其导出为 pdf 格式?这是不可能的..你应该看看 iTextSharp。