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

1 posts, 0 answers
  1. Dayana Maliyakal
    Dayana Maliyakal avatar
    27 posts
    Member since:
    Jan 2010

    Posted 29 Jun 2010 Link to this post

    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();

Back to Top