Jump to content
  • 0

Download PDF without going to the related DataPage


Peterson
 Share

Question

We have a list of completed classes for a student with a button to "Download Certificate". The button takes them to a new DataPage where all of the details are gathered and organized. It isn't pretty until you click Download PDF and get the final, beautifully formatted Certificate of Completion PDF download.

Is there a way to go straight to the Download PDF without having to go to the DataPage that creates the PDF? It would be much cleaner if they pressed the button and didn't leave the DataPage with the list of completed classes. In fact, they should be able to immediately click on any other "Download Certificate" button for as many completed classes as they wanted.

Alternatively, if they had to go to the DataPage, is there a way to automatically trigger the Download PDF so they don't have to take that extra step while a popup message says "Your Certificate is downloading" and then 5 seconds later they are pushed back to the original DataPage with the list of completed classes? It's unnecessarily clunky but at least the student would understand what is happening.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
On 6/26/2021 at 12:41 PM, Peterson said:

We have a list of completed classes for a student with a button to "Download Certificate". The button takes them to a new DataPage where all of the details are gathered and organized. It isn't pretty until you click Download PDF and get the final, beautifully formatted Certificate of Completion PDF download.

Is there a way to go straight to the Download PDF without having to go to the DataPage that creates the PDF? It would be much cleaner if they pressed the button and didn't leave the DataPage with the list of completed classes. In fact, they should be able to immediately click on any other "Download Certificate" button for as many completed classes as they wanted.

Alternatively, if they had to go to the DataPage, is there a way to automatically trigger the Download PDF so they don't have to take that extra step while a popup message says "Your Certificate is downloading" and then 5 seconds later they are pushed back to the original DataPage with the list of completed classes? It's unnecessarily clunky but at least the student would understand what is happening.

Set the Details Page Link to open in a pop-up, then, you can put this in the Footer of the Details Page 

<script>

document.addEventListener("DataPageReady",function(e){

document.querySelector("div[id^='cbOuterAjaxCtnr']").style.display="none";

var downloadPDF = document.getElementsByClassName("cbFormDownloadDetailsLink")[0];
downloadPDF.click();

});

</script>

This script hides the details page contents (2nd line)

and then clicks the download pdf button.

You can search for delay functions to put the downloadPDF.click() inside, but, I have a hard time estimating the right time to use to not close the page before the file starts to get downloaded, up to you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...