Create a PDF using Rotativa and Show in Another Window as Response

This code snippet using the Controller Context Response to view the PDF file in another window without downloading it or showing in the same window. Below is the snippet:
  1. public ActionResult ReportTest()   
  2. {  
  3.     var pdfResult = new PartialViewAsPdf("_pdfTemplate"//This is HTML that would be generated as PDF    
  4.     {  
  5.   
  6.         FileName = Constants.PDF_REPORT_NAME + DateTime.Now.ToShortDateString() + Constants.PDF_EXT,  
  7.             //Change the name and constants confirm form client    
  8.             CustomSwitches = "ADD SWITCHES HERE FOR HEADER FOOTER"  
  9.     };  
  10.   
  11.     Response.Clear();  
  12.     Response.ClearContent();  
  13.     Response.ClearHeaders();  
  14.     //Send the file to the output stream    
  15.     var resultSet = pdfResult.BuildPdf(ControllerContext);  
  16.     Response.Buffer = true;  
  17.     //Set the output stream to the correct content type (PDF).    
  18.     Response.ContentType = "application/pdf";  
  19.     Response.AddHeader("Accept-Ranges""bytes");  
  20.     //Output the file    
  21.     Response.BinaryWrite(resultSet);  
  22.     //Flushing the Response to display the serialized data    
  23.     Response.End();  
  24.     Response.Flush();  
  25.     //to the client browser.    
  26.     return null;  
  27. }  
Hope this helps in any application of yours where you are generating PDF and showing in another window using Rotativa.