I have a web form with a grid.I want to generate a pdf of the whole web form and grid data,save it on the server side itself,without saving it on the local machine as we do while exporting data to pdf, and send that pdf as an email attachment.All these functionalities i want to perform while the website is live on server.How can i achieve this task.
I have the code to convert grid data to pdf,but dont know how to save that pdf file on server
i m using following type of code for converting to pdf
private void Export_to_Pdf()
{
Response.ContentType = “application/pdf”;
Response.AddHeader(“content-disposition”, “attachment;filename=DotnetGeekBlog.pdf”);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
string str = “<h1 title=’Header’ align=’Center’> Writing To PDF Using ASP.NET</h1> <br><table align=’Center’><tr><td style=’width:100px;color:green’> <b>iTextSharp</b></td><td style=’width:100px;color:red’>dotnetgeekblog</td></tr></table>”;
StringReader sr = new StringReader(str);
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0.0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
the file just gets downloaded on the local machine.i want to save it on server and send it in email.
Thanks in advance.