[6.0.0] Width of PDF generated via "Edit Report" > "Content format" > "Send as PDF" is not visible but must be set by selecting before "Content format" > "Send as PNG" > "Screenshot width"
Bug description
For reports and alerts, no field offers to set the width of the PDF.
=============================================================
Very strangely, the value of the width of the PDF can be fixed if it is previously written in "Edit Report" > "Content format" > "Send as PNG" > "Screenshot width"... , then by changing "Content format" to "Send as PDF" 🤔
=============================================================
In the screenshot example above, my PDF is indeed output at a width of 2200 pxl (= 776 mm *72 dpi / 25,4 mm/inch). (Indeed, I noticed that for a configuration set in "custom_superset_config.py" with "WEBDRIVER_WINDOW = {"pixel_density": 1,}" (which is the case in this example), all the screenshots are done at 72 dpi.)
=============================================================
Moreover, given that the width of the reports must be located between 1200 and 2400 pxl * {"pixel_density": X,} and given the 72 dpi or more of the screenshots, it should be noted that in the current state, it is impossible to generate a PDF with a width corresponding to the ISO A4, A3 or A2 format. (420 mm = 1191 pxl). Only the widths of ISO A1 (594 mm = 1684 pxl) or even larger PDF formats... are possible.
The solution would be to add a field "Edit Report" > "Content format" > "Send as PDF" > "Width in mm", where we could add the width of an ISO format with a resolution higher than 72 dpi (insufficient quality for A4 -> 200 or 300 dpi would be ideal in this case).
Screenshots/recordings
No response
Superset version
6.0.0
Python version
3.11
Node version
18 or greater
Browser
Chrome
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.
Hello! I would like to work on this issue. My Analysis: After reviewing the issue, it appears that the Screenshot width field is conditionally rendered only when the report_format is set to PNG. However, the PDF generation also relies on this width for proper layout.
Proposed Fix:
- Update the visibility logic in the AlertReportModal (or relevant frontend component) to display the width input when either PNG or PDF is selected.
- Ensure the backend PDF generation task correctly consumes the screenshot_width value from the report metadata.
Could you please assign this to me? Thanks!
Hi! I see that someone has already expressed interest here. Since there’s no PR yet, I’m planning to start working on this as well. If there’s already progress happening, please let me know, happy to coordinate or step back. Thanks!
@YousufFFFF Thanks for checking. I have started working on this. I’ll open a PR soon. Happy to coordinate if you’re also exploring a solution.
Thanks for the update, Abhishek, appreciate you letting me know. I’ll step back for now to avoid duplicating effort. Happy to review, test, or help out once your PR is up. Good luck with it!