Repository navigation
feat: print stylesheet for printing and saving as PDF (#368) - #379
Merged
Merged
Conversation
Printing a page (or "Save as PDF" in the print dialog) now gives the page as shown on screen without the on-screen chrome: - hide the navbar, toasts, modals, graph/layout/widget controls, info icons, note edit buttons and the DataTables search, paging and sort arrows; section filters stay as plain values - rebuild the GridStack layout as a CSS grid from the --gs-x/y/w/h variables, with rows scaled to the page width, so tiles keep their position and proportions and are never split over pages; this also overrides the print rules of gridstack.css, which size tiles to content - scale the on-screen Chart.js drawing into each tile (object-fit), print graphs that scroll in .vertical whole, let tables grow their row - a fullscreen graph prints alone on one page, collapsed sections print their header only, landscape pages, white paper in both themes - remove the old print rules (their selector had a typo and never matched) and the no-op window.onbeforeprint in database.js - docs: Printing and PDF section in tabs-pages.md Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #368. This covers the print / PDF part (level 2) only. Per-graph PNG/CSV export (level 1) and data export (level 3) are left until someone asks for them.
What it does
Printing a page with Ctrl+P, or Save as PDF in the print dialog, now gives the page as it looks on screen (theme, filters, layout, custom graphs, widgets, notes), without the on-screen controls:
--gs-x/y/w/hvariables GridStack sets on each tile. Rows scale with the page width (cqw), so tiles keep their position and proportions and are never split over two pages. A section moves to a new page when it doesn't fit.object-fit: contain, without stretching. Graphs that scroll inside.verticalprint whole.Fixes
@media printblock in06-graphs.cssnever applied: its selector had a typo (.grid-stack-item-contentvas). Removed.window.onbeforeprintindatabase.jsreturned a Promise, which browsers ignore. Removed.gridstack.cssships print rules that size tiles to their content. The new stylesheet overrides them.Files
css/components/11-print.css, CSS only.docs/tabs-pages.md.Testing
vitestis missing fromnode_modulesand Docker wasn't running. No JS test touchesdatabase.js.🤖 Generated with Claude Code