Spinner while PDF is being rendered

Bauer

Well-Known Member
I had given up on using the PDF feature until I started researching why I was getting an error if I tried using it - and found an old forum thread that suggested the ordering of the Fabrik system plugin might be the culprit. (And it was)

But then I ran into the timeout error that the Dompdf library is apparently famous for. However by creating a few menu items that pre-filtered the data, I was able to use the PDF option without error.

BUT (I always have a lot of buts don't I?) - it would be nice to have something going on while the PDF is being rendered. :( The user has no idea if their click on the PDF icon even did anything.

Would I be able to cover the list with a wait spinner (like the optional spinner feature when Fabrik forms are submitted) while the PDF is being compiled and rendered?
 
Possibly, with some custom JS listening for a click event on the pdf button ... but I'm not sure how you would then remove the spinner, because the PDF button is just a link, which the browser then handles via MIME types (and typically either downloads, or displays in a new window). So it's not an AJAX call which returns, with an onComplete handler you can then remove the spinner with, or a link (like non-AJAX form submission) that then reload the page.

So I really can't think of where you could hook in and remove the spinner once the PDF is downloaded.

Which iirc is why we don't do this.

-- hugh
 
Yep that's the problem I came up against. I got a spinner to show - it's removing it that's the problem.
Hmm. I'll let you know if I find a solution.:(
 
Yeah, it's coming back to me now. Years ago, in Fabrik 2.x, I had a way to do this, because the browser would fire a window blur/focus when the download happened. But modern browsers don't do that any more. I just went googling again, and it doesn't seem like anyone has figure dout a workaround yet, that doesn't involve AJAX calls and session tokens ... where the download script adds a session token when it starts, and removes it when it finishes, and the client polls with AJAX and the token, to a method that returns true once the token is gone from the session ... which is a lot more work than I want to put in to that feature.

I think the best you can do is provide some feedback, insert something in the dom to the effect that the download has started, and will be done some time before Christmas.

-- hugh
 
:p My belly laugh of the day, thank you.
Yeah it's no big deal. Only one table takes really long to render and I suppose I could attach a confirm popup to that list when the PDF is clicked. (actually I think that would be the 'mousedown' event that fires before the click event - at least that's what worked for displaying the spinner)

I'm just glad that I finally found why PDF stopped working a while back for me - and I'll probably know why next time.
Thanks for the feedback and taking the time to explain.:)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top