PDF export isn't something I can email, but I can do better — I'll build a one-click "Export PDF" feature into the dashboard that generates a print-ready, paginated executive report (cover page, KPI snapshot, charts, insights, recommendations, data extract) that you save as a PDF from the browser dialog.
First, I'll add print-optimized styling, class-based dark mode, and the project fonts to the stylesheet.
Now I'll create the print-only report cover page containing the project title, business context, reporting period, active filters, KPI snapshot, and methodology notes.
Next, I'll add an "Export PDF" button to the header and mark the interactive toolbar so it's excluded from the printed report.
Now I'll insert the Export PDF button into the header's action toolbar next to the CSV export.
Now I'll make the data table print-aware so the PDF includes a clean data extract without the pagination controls.
I'll now wire the print row limit into the table body and hide the interactive controls during export.
Now I'll hide the search/export controls and pagination in the printed output, and add a print-only extract note.
I'll exclude the interactive filter bar from the printed report since the cover page documents the applied filters.
Finally, I'll wire the PDF export flow into the app: it switches to a light, report-width layout, lets the charts re-measure, then opens the print dialog.
The build succeeded. I can't email you a file, but the dashboard now generates the PDF itself.
How to get your PDF
- Open the dashboard (
dist/index.html)
- Click the red "Export PDF" button in the top-right toolbar
- In the print dialog that appears, choose:
- Destination → Save as PDF
- Layout → Landscape
- More settings → tick Background graphics (keeps chart colours)
- Click Save
What I built for the export
A print-only cover page that only appears in the PDF, containing:
- Report masthead, generation date, "Prepared for: Sales Managers & Executives"
- Business context and reporting scope (period, records analysed, dimensions)
- Applied filters — dynamically lists whatever filters are active, so the PDF is self-documenting
- KPI snapshot table with current values, Δ vs prior period (▲/▼), and the calculation definition for each metric
- Data source & preparation and Data limitations panels
A proper print stylesheet:
- A4 landscape page setup with sensible margins
- Interactive chrome (header, filter bar, pagination, search boxes, modals) is stripped out via a
no-print class
break-inside: avoid on every card so charts and tables never split across pages
- Deliberate page breaks before the KPI grid, regional section, insights, and data table
- Shadows flattened, sticky positioning removed, colours forced to print exactly
Smart export handling in the app:
- Temporarily switches to light mode (ink-friendly, better contrast on paper), then restores your theme afterwards
- Narrows the layout to report width and waits ~500 ms so Recharts re-measures — this prevents the classic problem of charts overflowing the page edge
- The data table swaps pagination for a clean 22-row extract with a footnote pointing to the CSV for the full dataset
- A preparation overlay shows the exact print-dialog settings to choose
I also fixed a latent issue while in there: dark mode was using Tailwind v4's default prefers-color-scheme behaviour, so the dark: utility classes weren't responding to your toggle. It's now configured as a class-based variant, and the Plus Jakarta Sans / JetBrains Mono fonts are properly registered in the theme.
Files built: src/index.css, src/components/PrintReportCover.tsx, src/components/Header.tsx, src/components/DataTable.tsx, src/components/FilterBar.tsx, src/App.tsx