Jump to content
  • 0

Download PDF without going to the related DataPage


Peterson

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

3 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

  • 0
On 6/28/2021 at 6:12 PM, TellMeWhy said:

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.

This is mega helpful so thank you for sharing.

I have created a QR code that when scaned, takes the user straight to the details page to print a badge. 

Using this, I have now been able to bypass them having to press the download pdf button and it looks a lot cleaner which is brilliant. Also saves a second or so which is great as we are trying to process multiple people in a short space of time.

The only v. small downside (and I can live with it if needs be) is that it opens the PDF on a new tab. Do you know if there would be a way to close the original details page tab once it opens the new PDF tab to save the user from having to go back and close that tab each time?

Thank you in advance for your help, you have already made my day!

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...
×
×
  • Create New...