I have a script that generates a bunch of PDFs on the fly. It works fine so long as it's the only code and I put it in Page_Load() event. However, I want to put it inside of a Button Click event now and I'm having problems.
What happens is I click the button, call a routine to create the PDFs as follows:
Response.ContentType = "application/pdf";
// a bunch of code that creates the PDFs.
When I put it in the button click it works fine, but at the end I have a blank screen. What I need is my form back with the button and other form objects. That's not happening because I have the Response.End statement in there. The problem is, if I remove it I get the following Adobe Reader error:
File does not begin with '%PDF-'.
Thanks for any help.