I am developing a web application in which the clients wants to generate a pdf of the current page.
I google a lot about this but didn't find any suitable solution to the problem.

Many dlls and classes are available but no one is working.

The main problem is that the page for which I want to generate PDF is secure and when I give the URL of the page, it will generate the PDF of Login page. Please sort out my problem.

With Regards,
Mandeep Singh

can you please tell me the Detaild Info about your Problem

Thanks for your kind reply.

Detailed Info:
There is a Membership Security on each page as if any body make a direct request to the Secure Pages it will be redirected to the Login Page.

CODE SNIPPET

protected void btnCreatePDF_Click(object sender, ImageClickEventArgs e)
        {
            Document doc1 = new Document();

            string path = Server.MapPath("PDF");
            PdfWriter.GetInstance(doc1, new FileStream(path + "/Doc3.pdf", FileMode.Create));

            doc1.Open();

            doc1.Add(new Paragraph(GetHtmlPage()));

            doc1.Close();
}

private string GetHtmlPage()
        {

            String strResult;
            WebResponse objResponse;
            WebRequest objRequest = HttpWebRequest.Create(Request.Url.AbsoluteUri);
            objResponse = objRequest.GetResponse();
            using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
            {
                strResult = sr.ReadToEnd();
                sr.Close();
            }
      }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.