This is a migrated thread and some comments may be shown as answers.

send the PDF document as a response to the browser for download

0 Answers 92 Views
AJAX and Web 2.0
This is a migrated thread and some comments may be shown as answers.
Dayana Maliyakal
Top achievements
Rank 1
Dayana Maliyakal asked on 29 Jun 2010, 08:12 AM

Hi,
    The following code does not work properly.Contents are displayed in first page only.Second page is appeared as blank page.Heading alignments are wrong.What is wrong with the following code?



System.Web.

HttpResponse response = System.Web.HttpContext.Current.Response;

 

response.Clear();

response.AddHeader(

"Content-Type", "binary/octet-stream");

 

response.AddHeader(

"Content-Disposition",

 

 

"attachment; filename=file1.pdf; size=" + pdfBytes.Length.ToString());

 

response.Flush();

response.BinaryWrite(pdfBytes);

response.Flush();

response.End();

No answers yet. Maybe you can help?

Tags
AJAX and Web 2.0
Asked by
Dayana Maliyakal
Top achievements
Rank 1
Share this question
or