feat: configurable page margins with printer-safe defaults (report-print)#1510
Open
the-narwhal wants to merge 1 commit intofrappe:masterfrom
Open
feat: configurable page margins with printer-safe defaults (report-print)#1510the-narwhal wants to merge 1 commit intofrappe:masterfrom
the-narwhal wants to merge 1 commit intofrappe:masterfrom
Conversation
Add top/right/bottom/left margin controls (in cm) to the right-hand settings pane of the Report Print View. Margins are applied as inline CSS padding on the content container, which is embedded in the printed HTML and survives the print stylesheet's specificity rules for both Save as PDF and the physical Print dialog. - Default margins initialise to 1.5 cm on all sides, which clears the hardware-imposed minimum of every common laser and inkjet printer while giving reports a clean, professional appearance - "Use Recommended" button resets all four sides to 1.5 cm (~0.6 in) in one click, with a hint label explaining why that value was chosen - Float inputs (0–5 cm, decimal precision) arranged in a 2×2 Top / Bottom / Left / Right grid; preview updates live as values change - No IPC or backend changes required; margins travel inside the HTML content div, keeping the existing @page { margin: 0 } contract intact
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.
Problem
When opening the Report Print View for any financial report (General Ledger, Profit & Loss, Trial Balance, and Balance Sheet) and clicking Save as PDF or Print, the report content renders flush to the page edge. This causes two issues:
Solution
A Page Margins section has been added to the existing right-hand configuration pane in the Report Print View. It sits between the Size Selection and Pick Columns sections.
Controls
Floatinputs — Top, Bottom, Left, Right — each accepting 0–5 cm with decimal precision1.5 cmin one clickDefault behaviour
Margins initialise to 1.5 cm on all sides. This was chosen because:
1.5 cm comfortably clears every printer's minimum and matches the default margins used by word processors such as Microsoft Word and Google Docs.
Why no backend changes were needed
The margins are applied as an inline CSS
paddingon the content container div insideScaledContainer. Because inlinestyleattributes have higher CSS specificity than the* { padding: 0 }rule in the print stylesheet, the padding survives the print render unchanged. The padded HTML is embedded directly in the content string passed throughconstructPrintDocument, so bothprintToPDF(Save as PDF) and the nativeprintdialog path pick it up automatically. The existing@page { margin: 0 }contract in the print CSS is preserved.Files changed
src/pages/PrintView/ReportPrintView.vueFloatimport,marginsdata,contentPaddingStylecomputed,setRecommendedMarginsmethod, margin UI section in settings paneTesting
Example of new margin configuration set to 0:

Example of new margin configuration set to 1.5:
