Fix PDF/print margins: respect Page Setup, remove double margins#329
Merged
Conversation
Contributor
Code Coverage ReportCurrent Coverage: 56.42% Coverage Details (Summary) |
The printInfo method hardcoded all four margins (top/bottom 50pt, left/right 0pt), overriding whatever the user configured via File > Page Setup. This made the Page Setup dialog effectively non-functional for margin control. Additionally, all CSS stylesheets added body padding/margin of 2cm in their @media print blocks, which compounded with the NSPrintInfo margins to create unpredictable whitespace. This commit: - Removes hardcoded margin values from printInfo, allowing NSPrintInfo (controlled by Page Setup) to be the single source of truth - Zeros out @media print body padding/margin in all 8 bundled stylesheets (including GitHub Tomorrow.css and the centralized print.css, which are MacDown 3000 additions beyond the original 6) Users can now control PDF/print margins via File > Page Setup (Cmd+Shift+P). Based on MacDownApp/macdown PR #1363. Related to MacDownApp/macdown#1363
0373225 to
3e234bc
Compare
5 tasks
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.
Summary
Port of MacDownApp/macdown PR #1363, adapted for MacDown 3000:
printInfoinMPDocument.m— the method was overwriting all four margins (top/bottom 50pt, left/right 0pt) every time, making theFile > Page Setup...dialog non-functional for margin control@media printbody padding/margin in all 8 bundled CSS stylesheets (the original 6, plusGitHub Tomorrow.cssand the centralizedprint.csswhich are MacDown 3000 additions)File > Page Setup...(Cmd+Shift+P), with NSPrintInfo as the single source of truthChanges beyond the original PR
The original PR touched 7 files (1
.m+ 6 CSS). This port touches 9 files because MacDown 3000 has:GitHub Tomorrow.css— a new theme stylesheet with the samepadding: 2cmissueExtensions/print.css— a centralized print stylesheet (from PR #1349 port) that also hadpadding: 2cm, which would compound with NSPrintInfo marginsGitHub-2020.csshas no@media printblock, so no changes needed there.Test plan
File > Page Setup...to set custom marginsFile > Export > PDF...— verify PDF reflects the configured marginsFile > Print...— verify print preview shows the configured marginsRelated to MacDownApp/macdown#1363