Dashboard "Export as PDF" doesn't split a long table when it's the last card on the dashboard
Describe the bug
Normally, "Export as PDF" in the dashboard header splits a tall table card across pages between rows.
However, when the table is the last card on the dashboard the splitting does not occur. In that case the whole table goes onto one very long page.
So a dashboard that is just one long table (the most common "report" layout) always exports as a single page that can't be printed. Adding any card below the table, for example a small text card, makes the same table paginate correctly.
To Reproduce
- Create a question that returns 100 rows, displayed as a table.
- Create a dashboard and add the question at full width. Make the card tall enough to show all 100 rows.
- Click Share → Export as PDF. The PDF has 1 page, several times the height of an A4 page.
- Edit the dashboard and add a text card below the table. Save.
- Click Share → Export as PDF again. The PDF now has 4 pages, split cleanly between rows, with all 100 rows, which is the expected behavior.
Expected behavior
The table should be split across pages between rows in both cases, whether or not anything is placed below it. Its position on the dashboard shouldn't decide whether the PDF can be printed.
Logs
No errors
Information about your Metabase installation
v1.64.0-beta, masterSeverity
Exporting a single-table report gets an unprintable PDF. Workaround is hard to discover.
Additional context
frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts,findPageBreakCandidates:.filter((card) => card.bottom < maxBottom)drops the whole lowest card, including its row breaks (allowedBreaks, fromdata-allow-page-break-afterinDataGridRow.tsx/PivotTableCell.tsx). The filter only needs to skip that card's bottom edge.- The same applies to pivot tables.
- Separate from, but often confused with:
Source: metabase/metabase