devlev1980
3/14/2018 - 8:53 AM

Download pdf from Link

 downloadFile(data) {
    const oReq = new XMLHttpRequest();
// The Endpoint of your server
    const URLToPDF = `http://82.81.136.140/DevSignaturesFlowAPI/api/GetDocument?signFlowId=${data.SignFlowId}&dummy=true`;

// Configure XMLHttpRequest
    oReq.open('GET', URLToPDF, true);

// Important to use the blob response type
    oReq.responseType = 'blob';

// When the file request finishes
// Is up to you, the configuration for error events etc.
    oReq.onload = function () {
      // Once the file is downloaded, open a new window with the PDF
      // Remember to allow the POP-UPS in your browser
      const file = new Blob([oReq.response], {
        type: 'application/pdf'
      });

      // Generate file download directly in the browser !
      saveAs(file, data.Description);
    };

    oReq.send();

  }


}