• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

PDF Embed API: Need a download method for Custom Force Download Button

Explorer ,
Sep 24, 2021 Sep 24, 2021

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.

TOPICS
PDF Embed API

Views

756

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Sep 27, 2021 Sep 27, 2021

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.

Votes

Translate

Translate
Explorer ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources