Export as PDF file from C# page
-
hi all, I want export the pdf file.and I am using following code.In my system .But an error is displaying like adobe readercould not open 'down.pdf' because it is either not a supported file type or because the file has been damaged... DataSet Ds = FillGrid2(sessionvalue, cid, cmid, crid, pid, sdate, edate); Response.Clear(); Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-disposition", "attachment; filename=Download.pdf"); string str = "<table style='border:1px solid #000000;'>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Client: </b>" + client + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Campaign: </b>" + campaign + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Report Summary</b>" + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td>" + "Type" + "</td>"; str += "<td>" + "Impression" + "</td>"; str += "<td>" + "Clicks" + "</td>"; str += "<td>" + "Start Date" + "</td>"; str += "<td>" + "End Date" + "</td>"; str += "</tr>"; for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { str += "<tr style='border:1px solid #000000;'>"; for (int j = 0; j < Ds.Tables[0].Columns.Count; j++) { str += "<td>" + Ds.Tables[0].Rows[i][j].ToString() + "</td>"; } str += "</tr>"; } str += "</table>"; Response.Write(str); If anybody knows please reply me.. thanks...
Raaj