title: how to download a pdf file from an url in angular 5
body: <p>I currently spend one day in this issue,still failed to download a file from an url in angular 5</p>
  
  <pre><code>leadGenSubmit() {
  
      return this.http.get('http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf',
      {responseType:ResponseContentType.Blob}).subscribe((data)=&gt;{
          console.log(data);
          var blob = new Blob([data], {type: 'application/pdf'});
          console.log(blob);
          saveAs(blob, "testData.pdf");
      },
      err=&gt;{
          console.log(err);
          }
      )
  }
  </code></pre>
  
  <p>when I run above code it shows following error</p>
  
  <pre><code>ERROR TypeError: req.responseType.toLowerCase is not a function
      at Observable.eval [as _subscribe] (http.js:2187)
      at Observable._trySubscribe (Observable.js:172)
  </code></pre>
  
  <p>how can I solve this issue.Can any one post the correct code to download a  pdf file from an url in angular 5?</p>