J Hill

Generation

generate functionThu, 01 Dec 2022

Create code to download .pdf files to be stored on the cloud

function downloadPDF () { let url = 'https://example.com/pdf/download' return fetch(url) .then(response => response.blob()) .then(data => { var file = new Blob([data], {type: 'application/pdf'}); var fileURL = URL.createObjectURL(file); window.open(fileURL); }) }) }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant