My requirement is generating a itextsharp pdf file in button_click event on the fly without saving it in Local disk and there should be no save dialogue . Once the PDF is created we have to display it inside a div tag within the same asp.net page in a small size. Below is the code in which I am able to generate the PDF:
protected void Button2_Click(object sender, EventArgs e)
{
string PDFfileName = Path.GetFileNameWithoutExtension(fileName);
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-disposition", "inline;filename= " +
PDFfileName + ".pdf");
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Document pdfDoc = new Document(); PdfWriter.GetInstance(pdfDoc,
HttpContext.Current.Response.OutputStream);
pdfDoc.Open();
pdfDoc.Close();
HttpContext.Current.Response.Write(pdfDoc);
HttpContext.Current.Response.End();
}
Now the challenge which I am facing:
Solution which I want is the same pdf which is generated without saving it in disk should directly appear inside div tag in middle of the page and also it should not show any save dialogue message.
Please help me.