title: How to open PDF file in a new tab or window instead of downloading it using C# and ASP.NET MVC?
body: <p>I have invoice screen and in this screen there are number of order are available so when we create invoice there are one form we need to fill so I want solution is when I submit this invoice form or click this submit button pdf should be open in new tab. I want to clarify to you we are not save this pdf anywhere.</p>
  
  <pre><code>&lt;div class="modal-footer custom-no-top-border"&gt;
        &lt;input type="submit" class="btn btn-primary" id="createdata" value="@T("Admin.Common.Create")" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I click on this button, the pdf should be opened in a new tab.</p>
  
  <p>Here is pdf code</p>
  
  <pre><code> [HttpPost]
   public virtual ActionResult PdfInvoice(int customerOrderselectedId)
   {
          var customerOrder = _customerOrderService.GetCustomerOrderById(customerOrderselectedId);
  
          var customerOrders = new List&lt;DD_CustomerOrder&gt;();
  
          customerOrders.Add(customerOrder);
          byte[] bytes;
  
          using (var stream = new MemoryStream())
          {
              _customerOrderPdfService.PrintInvoicePdf(stream, customerOrders);
              bytes = stream.ToArray();
          }
  
          return File(bytes, MimeTypes.ApplicationPdf, string.Format("order_{0}.pdf", customerOrder.Id));
      }
  </code></pre>
  
  <p>This code downloads the pdf when I click on the button.</p>
  
  <p>Thank you !!</p>