0

I have a .aspx page and it has a button on click of which a radwindow opens .The radwindow has a new page with content including a button onclick of which a pdf is created and downloaded.I want the pdf to open in a new tab or window , so i made changes to my code -changed attachment to inline

Hashtable deviceInfo = new Hashtable();
    deviceInfo.Add("FontEmbedding", "Subset");
    deviceInfo.Add("DocumentTitle", String.Format("TrackitManager - {0}", reportToExport.DocumentName));
    deviceInfo.Add("DocumentAuthor", "Trackit Systems Pty Ltd");

    ReportProcessor reportProcessor = new ReportProcessor();
    RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, deviceInfo);

    if (String.IsNullOrEmpty(filename))
        filename = result.DocumentName;



    context.Response.Clear();
    context.Response.ContentType = result.MimeType;
    context.Response.Cache.SetCacheability(HttpCacheability.Private);
    context.Response.Expires = -1;
    context.Response.Buffer = true;
    //context.Response.TransmitFile("~/Handlers/EnrollmentPDF.ashx");

    context.Response.AppendHeader("Content-Disposition", string.Format("attachment; filename=\"{0}.pdf\"", filename));

    context.Response.BinaryWrite(result.DocumentBytes);

    context.Response.End();

But this is opening the pdf inside the radwindow itself.I want it to open in a new window but outside the radwindow.

  • possible duplicate of [How to open PDF file in a new tab or window instead of downloading it (using asp.net)?](http://stackoverflow.com/questions/8294057/how-to-open-pdf-file-in-a-new-tab-or-window-instead-of-downloading-it-using-asp) – user986959 Jul 04 '14 at 07:41

1 Answers1

0

you have to give the correct header and mimeType to tell the browser to download the file for that you just have to add this line to replace :

context.Response.ContentType = result.MimeType;

by this line :

Response.ContentType = "application/octectstream";
bobzer
  • 99
  • 1
  • 7