I have a paragraph in my personal CSS stylesheet for printing (printing on paper or converting to pdf) of my markdown documents. However, the resulting printout or pdf does not respect the page margins that I have defined in the CSS code. Any idea why? I have put this paragraph at the end of my CSS stylesheet, so that it should overwrite any potential other settings:
thank you a lot. Indeed I have searched in the forum and found another thread from you, but not this one. Thanks a lot for pointing it out. So if I understand it correctly, there is no easy possibility to get a good-looking printout from markdown documents, at least not with correct margins on all sides?
There isn’t a page margin setting for markdown printouts. There is a Page Setup. However, custom margins may be affected or disallowed by the chosen printer. Page size should be editable, margins may be.
This older posting of @BLUEFROG describes a perfect solution to handle page margins in markdown printouts:
Thank you, Jim. Indeed, I wasn’t aware that with a customized page setting it is possible to define margins, whereas it is not possible to define them with the CSS stylesheet consistently for all pages. Now, I have a customized page setting for printing/converting markdown documents, and a standard page setting for printing other documents (PDF etc.)
To clarify: you can define all page attributes just fine with CSS. But Firefox and Safari are seriously lacking in implementing those attributes. And there are more than just margins, like orphan and widow control, forced page breaks (eg before a level 2 heading) etc.
If you need full and fine control over print layout, use Chrome to print your MD/HTML documents and an appropriate style sheet.