GitHub user dosubot[bot] added a comment to the discussion: Page breaks in 
exporting dashboards to PDF

<!-- Greeting -->
Hi @Pawel-Serkowski! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.

<!-- Answer -->
Explicit page breaks for one chart per PDF page are **not currently supported** 
in Superset's dashboard PDF export. The fundamental limitation is that 
dashboard exports use screenshot-based rendering (via 
[Playwright/Selenium](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/webdriver.py)
 → [PIL image-to-PDF 
conversion](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/pdf.py#L30-L49)),
 which doesn't support CSS page-break controls.

**Closest workaround:** Use the **alerts/reports system with multi-tab 
dashboards**. If you enable the `ALERT_REPORT_TABS` feature flag and [create 
one dashboard tab per chart](https://github.com/apache/superset/pull/30694), 
each tab exports to a separate PDF page. This requires using scheduled reports 
rather than the direct "Dashboard > Download > Export PDF" option.

**In development:** [PR #35014](https://github.com/apache/superset/pull/35014) 
introduces intelligent pagination with CSS `page-break-inside: avoid` and 
`@page` directives using WeasyPrint, but it's limited to **table-based charts** 
in reports only—not general dashboard exports with line charts, bar charts, etc.

To get true per-chart page breaks for arbitrary visualizations, this would 
require architectural changes to switch dashboard exports from screenshot-based 
to HTML-to-PDF conversion (similar to what the alerts/reports system already 
uses). That would indeed require custom backend/renderer modifications.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/a7a95bb4-f597-4193-82ed-62785e21d6a9?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Explicit%20page%20breaks%20for%20one%20chart%20per%20PDF%20page%20are%20%2A%2Anot%20currently%20supported%2A%2A%20in%20Superset%27s%20dashboard%20PDF%20export.%20The%20fundamental%20limitation%20is%20that%20dashboard%20exports%20use%20screenshot-based%20rendering%20%28via%20%5BPlaywright/Selenium%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/webdriver.py%29%20%E2%86%92%20%5BPIL%20image-to-PDF%20conversion%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/pdf.py%23L30-L49%29%29%2C%20which%20doesn%27t%20support%20CSS%20page-break%20controls.%0A%0A%2A%2AClosest%20workaround%3A%2A%2A%20Use%20the%20%2A%2Aalerts/reports%20system%20with%20multi-tab%2
 
0dashboards%2A%2A.%20If%20you%20enable%20the%20%60ALERT_REPORT_TABS%60%20feature%20flag%20and%20%5Bcreate%20one%20dashboard%20tab%20per%20chart%5D%28https%3A//github.com/apache/superset/pull/30694%29%2C%20each%20tab%20exports%20to%20a%20separate%20PDF%20page.%20This%20requires%20using%20scheduled%20reports%20rather%20than%20the%20direct%20%22Dashboard%20%3E%20Download%20%3E%20Export%20PDF%22%20option.%0A%0A%2A%2AIn%20development%3A%2A%2A%20%5BPR%20%2335014%5D%28https%3A//github.com/apache/superset/pull/35014%29%20introduces%20intelligent%20pagination%20with%20CSS%20%60page-break-inside%3A%20avoid%60%20and%20%60%40page%60%20directives%20using%20WeasyPrint%2C%20but%20it%27s%20limited%20to%20%2A%2Atable-based%20charts%2A%2A%20in%20reports%20only%E2%80%94not%20general%20dashboard%20exports%20with%20line%20charts%2C%20bar%20charts%2C%20etc.%0A%0ATo%20get%20true%20per-chart%20page%20breaks%20for%20arbitrary%20visualizations%2C%20this%20would%20require%20architectural%20changes%20to%20swit
 
ch%20dashboard%20exports%20from%20screenshot-based%20to%20HTML-to-PDF%20conversion%20%28similar%20to%20what%20the%20alerts/reports%20system%20already%20uses%29.%20That%20would%20indeed%20require%20custom%20backend/renderer%20modifications.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/38337)

GitHub link: 
https://github.com/apache/superset/discussions/38337#discussioncomment-15969309

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to