Copy link to clipboard
Copied
We know that the embedded PDF itself has the download button, but for better user experience, we want to create a larger download button that allows our users to easily notice it and download the PDF file. Unfortunately, as we all know, the HTML5's download attribute is for the same-origin only. Therefore, we wonder if Adobe PDF Embed API could expose a download method from their AdobeDC.View object that will work exactly the same as the download button in the embedded toolbar. Any chance to have that feature or it's already available but I could have missed something?
Thank you.
Since I'm using Node.js, I've figured out how to solve this:
app.get("/download", (req, res) => {
res.type("application/octet-stream");
// Put the same URL as the one used in PDF Embed API
// for the res.attachment() below:
res.attachment("https://domainname.com/downloads/fiename.pdf");
res.send("File downloaded!");
});
So in my HTML:
<!-- You don't even need to put target="_blank" -->
<a class="a-very-big-button" href="/download">Download PDF</a>
So consider it done, thanks.
Copy link to clipboard
Copied
Since I'm using Node.js, I've figured out how to solve this:
app.get("/download", (req, res) => {
res.type("application/octet-stream");
// Put the same URL as the one used in PDF Embed API
// for the res.attachment() below:
res.attachment("https://domainname.com/downloads/fiename.pdf");
res.send("File downloaded!");
});
So in my HTML:
<!-- You don't even need to put target="_blank" -->
<a class="a-very-big-button" href="/download">Download PDF</a>
So consider it done, thanks.