-
-
Save oleg-am/92a1e777cbf0d1cbd84d0c08ced854ce to your computer and use it in GitHub Desktop.
Save PDF using javascript (isomorphic-fetch and file-saver)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'isomorphic-fetch' | |
import { saveAs } from 'file-saver' | |
fetch('/url/with/pdf', { | |
headers: { | |
'Content-Type': 'application/pdf' | |
}, | |
responseType: 'blob' | |
}).then(response => response.blob()) | |
.then(blob => saveAs(blob, 'test.pdf')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment