title: How to open PDF file instead of downloading it in browser in angular?
body: <p>I have my front end in Angular 4 and Back end at Dot net, I have one URL and when I hit that URL in browser a PDF is being Downloaded but I want to show it in Browser.</p>
  
  <p>I received that URL through a get call and then I am opening that URL in new window but it is being always downloaded.</p>
  
  <p>Here what I tried : </p>
  
  <p>ts file code: </p>
  
  <pre><code>this.http.get(this.pdfUrl, { params: { data: JSON.stringify(prospect) }})
                  .subscribe(data =&gt; {
  
                      var strWindowFeatures = "location=yes,height=570,width=520,scrollbars=yes,status=yes";
                      window.open(data.url, "_blank", strWindowFeatures);
                  },
                      error =&gt; {
                          console.log(error);
                      })
          ]).then(function (result) {
              if (result) {
                  console.log("ok");
              }
            });
  </code></pre>
  
  <p>In the response of this get call, I receive PDF file data in encrypted format and a URL through which PDF is downloaded.</p>
  
  <p>my Controller code: </p>
  
  <pre><code>                HtmlToPdf converter = new HtmlToPdf();
                  var rootDir = this.environment.ContentRootPath;
  
                  rootDir = this.environment.ContentRootPath + "/bin/Debug/netcoreapp2.0";
  
                   IHTMLTemplateProvider proposalProvider = new ProposalProvider();
                  proposalProvider.LoadDocument(rootDir + "/templates/Proposal.html");
  
                  proposalProvider.ParseDocument();
  
                  string notificationContent = await proposalProvider.GetDocumentInText().ConfigureAwait(false);
                  SelectPdf.PdfDocument doc = converter.ConvertHtmlString(notificationContent);
  
                  byte[] pdfData = doc.Save();
                  doc.Close();
  
                  return File(pdfData, "application/pdf", "document.pdf");
  </code></pre>