2

I am writing a PDF file from C# like this:

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>");

When I save the file and open it, it throws an exception that file is not supported file type .. or file has been damaged.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Shah
  • 1,604
  • 4
  • 20
  • 33

1 Answers1

1

to create pdf form html you should have a look at it.

Render PDF in iTextSharp from HTML with CSS

to create tables using itextsharp have a look at it

http://www.mikesdotnetting.com/Article/86/iTextSharp-Introducing-Tables

Community
  • 1
  • 1
Shoaib Shaikh
  • 4,565
  • 1
  • 27
  • 35