title: How to display a pdf file return from REST API in pop-up
body: <p>I have a REST API that will return a file in base64 string.
  I have already be able to convert it back to file data to let user download the file in client-side when click on the link. The code is as below:</p>
  <pre><code>if(link !== undefined &amp;&amp; link !== null &amp;&amp; link.trim() !== &quot;&quot;){
      var setting = [];
      var urlGet = link; //example: &quot;../API/fileDownload?directory=AAA&amp;filename=BBB.pdf&quot;;
      const httpGet = new XMLHttpRequest();
      httpGet.open('GET', urlGet, false);
      httpGet.send();
      var returnText = httpGet.responseText;
      var returnStatus = httpGet.status;
      if(returnStatus == &quot;200&quot;){
          setting = JSON.parse(returnText);
      }
      if(setting !== undefined &amp;&amp; setting !== null ){
          var filename = setting.filename;
          var data = setting.data;
          var content = setting.content;
          
          var hiddenElement = document.createElement('a');
          hiddenElement.href = 'data:' + data + ';base64,' + content;
          hiddenElement.target = '_blank';
          
          //provide the name for the file to be downloaded
          hiddenElement.download = filename;
          hiddenElement.click();
      }
  }
  </code></pre>
  <p>However, now, I was ask to add a function that will open the file in a pop-up if it is a pdf.
  Let ignore the check to see if the file is pdf (just assume all files will be pdf), can you help me change the above code to do this.</p>