Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Problem Downloading PDF

runtime pdf

  • Please log in to reply
No replies to this topic

#1 McHenryGIS

McHenryGIS

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 11 March 2010 - 11:25 AM

We want the user to be able to download a PDF image when they go to print. However, when the user goes to open the file, we get an error message. Below is the notes we have on the problem. Do you have any ideas?

I tried to print the page to a PDF file,

By calling

string name = string.Format("athena-{0}.pdf", Guid.NewGuid().ToString().Substring(0, 8));
byte[] data = BuildPDF();

if (data != null)
{
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Type", "binary/octet-stream");
response.AddHeader("Content-Disposition", "attachment; filename=" + name + "; size=" + data.Length.ToString());
response.Flush();
response.BinaryWrite(data);
response.Flush();
response.End();
}

in “Print” button click handler.

If I make the Print user control in AJAX UpdatePanel, I got an error:

Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagerParserErrorException

I have tried to research this, but I am not able to solve the problem. Any Advice??
  • 0





Also tagged with one or more of these keywords: runtime, pdf

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download