Hello Sir,
I have problem in converting .Aspx page to .Pdf file. I have used your site link for implement it Link is: (http://www.aspsnippets.com/Articles/Export-ASPNet-Web-Page-with-images-to-PDF-using-ITextsharp.aspx#comments), but it provide error to me Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.
I have a method which is given below. when i call this mehtod on button cilck for genrate Pdf file for aspx page then it give above error message . So Please help me to solve this problem As soon as possible Sir.
code,
private void GenratePdf()
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pnlRender.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);
pdfDoc.Open();
htmlparser.Parse(sr); // Above Error in this line.
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}