1

I'm trying to convert a simple webpage to pdf using SelectPdf for .NET community version. the page is like survey, so user logins in and enter the details and should convert to PDF on the button click

The tool works great in dev environment. But when I moved it to production server..it fails to print the answers submitted by the user and pdf shows the blank page with just the question and answer fields( Answers are displayed on the screen) but not in the pdf.

User logs into the site with windows authentication

please see below code :

              <code>
                TextWriter myWriter = new StringWriter();
                HtmlTextWriter htmlWriter = new HtmlTextWriter(myWriter);
                base.Render(htmlWriter);

                // instantiate a html to pdf converter object
                HtmlToPdf converter = new HtmlToPdf();

                // create a new pdf document converting the html string of the page
                PdfDocument doc = converter.ConvertHtmlString(
                    myWriter.ToString(), Request.Url.AbsoluteUri);


                // save pdf document
                //// save pdf document
                string doc_Name = "_PDR.pdf";
                doc.Save(Response, false, lblTeamMemberName.Text + doc_Name);
                //doc.Save(Response, false, "Sample.pdf");

                // close pdf document
                doc.Close();

Krish
  • 35
  • 5

1 Answers1

0

SelectPdf converts the HTML that you feed to it. Log into a file the content of myWriter.ToString() and see if that HTML is what you expect (contains the answers).

Tom
  • 285
  • 2
  • 3