Thanks for your kind Reply,However it was needed for me to save the pdf doc in server and attach the same with the email every time when payment done,
I would like to share how I did that.
private void Sendpdf(string OrderID)
{
try
{
ThankYou_BLL obj = new ThankYou_BLL();
dspdf = obj.ThankUdetails(OrderID);
if (dspdf.Tables[0].Rows.Count > 0)
{
lblName.Text = dspdf.Tables[0].Rows[0]["FullNme"].ToString();
lblICNo.Text = dspdf.Tables[0].Rows[0]["NewICNo"].ToString();
lblEmail.Text = dspdf.Tables[0].Rows[0]["Email"].ToString();
lblType.Text = dspdf.Tables[0].Rows[0]["ProgramName"].ToString();
lblAmount.Text = "RM" + "" + dspdf.Tables[0].Rows[0]["Amount"].ToString();
lblOrderID.Text = dspdf.Tables[0].Rows[0]["OrderId"].ToString();
lblRegistrationDt.Text = dspdf.Tables[0].Rows[0]["JoinDate"].ToString();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pnlPerson.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
//PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
PdfWriter.GetInstance(pdfDoc, new FileStream(Context.Server.MapPath("~/PdfDoc/PaymentDetails.pdf"), FileMode.Create));
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
//Response.Write(pdfDoc);
//Response.End();
}
}
catch (Exception)
{
throw;
}
}
attahment the saved pdf like this.
Attachment mailattach = new Attachment(Path.GetFullPath(Context.Server.MapPath("~/PdfDoc/PaymentDetails.pdf")));