SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. axios(`${apiURL}/pdf`, {
  2.     method: 'GET',
  3.     responseType: 'blob' //Force to receive data in a Blob Format
  4. })
  5. .then(response => {
  6. //Create a Blob from the PDF Stream
  7.     const file = new Blob(
  8.       [response.data],
  9.       {type: 'application/pdf'});
  10. //Build a URL from the file
  11.     const fileURL = URL.createObjectURL(file);
  12. //Open the URL on new Window
  13.     window.open(fileURL);
  14. })
  15. .catch(error => {
  16.     console.log(error);
  17. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top