Bug description
When using the new Export to PDF functionality, we get a mostly empty PDF on the first try. Second export usually works fine. If we refresh the page - same issues reappear: first export is empty, second is fine.
The issue does not seem to impact Big Number and Table charts. But everything else: Pie Charts, Bar Charts, Area Charts, seem to be impacted.
How to reproduce the bug
- Open a dashboard which has a Pie Chart.
- Click Export to PDF
- Check PDF
Screenshots/recordings
First click on Export to PDF:
Second click on Export to PDF:
Superset version
3.1.1
Python version
3.10
Node version
Not applicable
Browser
Safari
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: Arcelone
Same issue for me, with the 4.0.1 version of superset.
Comment From: Spragalas
I also face exact same issue (4.0.1)
Comment From: hanslemm
Same problem, but worst: - For me it only prints what is visible on the screen. Anything outside it is not printed, but rather shows the Superset loading logo.
Is this using the webdriver component? If yes, perhaps it is not waiting long enough to take the screenshot.
Comment From: Arcelone
@hanslemm i think this is the issue. I don't know which technology they use to generate the pdf. But it may be just a option to force the rendering of all the page and not only the visible part.
Comment From: artyom738
Similar problem with embedded dashboard. When we export embedded dashboard, only visible charts are saved in pdf. If some charts are out of screen, in pdf we have loading logo instead of charts. I have attached a screenshot.
But when we export dashboard from superset (not embedded), pdf is saving correctly.
In addition (maybe it can help) - if you will try to scroll embedded dashboard quicky, you will see a loading logo by a millisecond before chart renders. It seems like charts that are out of screen are unloading.
UPDATE: I have debugged it - there is DASHBOARD_VIRTUALIZATION feature flag. If it is True, charts out of screen are removing from DOM. I set it False and export embedded dashboard now is working correctly. Maybe it would be right if all charts will be loaded back before exporting to pdf?
Comment From: rusackas
We suspect that this might be resolved in the current 4.1 release candidate. Please test and vote accordingly! Let me know if you need help with that, and make sure you subscribe to the dev@superset.apache.org mailing list (just send an email to dev-subscribe@superset.apache.org)
Comment From: Xyrai
@rusackas could this fix also get implemented within the @superset-ui/embedded-sdk
NPM package?
When my users try to print their page via the browser functionality, the same issue occurs where any chart outside of the viewport doesn't get rendered but displays the "loading" status instead.
Comment From: jpchev
We suspect that this might be resolved in the current 4.1 release candidate. Please test and vote accordingly! Let me know if you need help with that, and make sure you subscribe to the dev@superset.apache.org mailing list (just send an email to dev-subscribe@superset.apache.org)
hello, I'm testing witht the latest dev code, the issue is still present, there is no guarantee that all the charts of a dashboard are being sent to the pdf generation module.
BTW, is it possible to have Apache Superset generate the pdf on the server side?
Comment From: jpchev
hello, I think this is due to React (re)rendering mechanism, is it possible to disable that ?
It seems this line is being entered if the user "is a bot", which means by the web driver. Can that be put in OR with the condition that the user is on the web UI and it wants to get a pdf with all the charts rendered (that should always be true) ?
@rusackas what do you think?
Comment From: jpchev
I have created this PR https://github.com/apache/superset/pull/30935 to propose a fix
Comment From: rusackas
Hi all,
Are folks still facing this? It's been quiet for a long time now. With any luck, it was resolved along the way, but let me know if it's still happening in 4.1.2/5.0.0, and whether or not you have the PLAYWRIGHT_REPORTS_AND_THUMBNAILS
flag turned on or not.
Comment From: xavier-GitHub76
I have a similar issue on 5.0.0 but the correct export is the first.
After the export is KO
Comment From: rusackas
These all seem like they might effectively be the same issue:
https://github.com/apache/superset/issues/29394 https://github.com/apache/superset/issues/31158 https://github.com/apache/superset/issues/29719 https://github.com/apache/superset/issues/28713 https://github.com/apache/superset/issues/27532
Can anyone here test this with DASHBOARD_VIRTUALIZATION set to false
? I have a suspicion that may fix it. If so, we can probably just disable viewport virtualization when the headless browser is building the screencap.