edwardtufte / tufte-css

Style your webpage like Edward Tufte’s handouts.
https://edwardtufte.github.io/tufte-css/
MIT License
5.96k stars 458 forks source link

Can you add a page break tag? #30

Closed neuwirthe closed 9 years ago

neuwirthe commented 9 years ago

I would like to force pagebreaks when I print a web page with this style. I tried a few suggestions, e.g. http://www.htmlgoodies.com/beyond/css/article.php/3470341/CSS-and-Printing.htm

But I could not make any of these work. Could you consider adding such a style tag?

ghost commented 9 years ago

Have you tried https://stackoverflow.com/a/21270036

neuwirthe commented 9 years ago

This does not work as it should. This might be related to the dynamically defined font sizes.

On 07 Aug 2015, at 12:08, Nic notifications@github.com wrote:

Have you tried https://stackoverflow.com/a/21270036 https://stackoverflow.com/a/21270036 — Reply to this email directly or view it on GitHub https://github.com/daveliepmann/tufte-css/issues/30#issuecomment-128663053.

ghost commented 9 years ago

Works great for me. I just tested it.

ghost commented 9 years ago

Here is a gist to demonstrate how to do it: https://gist.github.com/xHN35RQ/c9cd616acc4b9bfb93ac

daveliepmann commented 9 years ago

Thanks for that gist, @xHN35RQ.

I'd like to add this functionality to tufte.css, and an example to index.html, but for me to feel OK doing so we'd need to also fix some other considerations for print. For instance, revert to pure black for text and pure white for the background. I'm tagging this help-wanted for anyone who wants to do that work; I don't have the desire to do the necessary testing right now.

ghost commented 9 years ago

I don't see any reason to add this. If you want to print to physical printer or to PDF, then you're much better off using pandoc's Tufte template and writing your content in Latex, Markdown, or any other input that pandoc accepts. tufte.css should probably remain a web centric project. Otherwise you're re-inventing the wheel.

Here's an example of using Pandoc to convert from Multi-Markdown to PDF using Tufte Latex to create Tufte styled PDF's - http://plaintextadventure.com/blog/instant-pdfs-via-right-click.html

Much better option than printing HTML/CSS from web browser.

daveliepmann commented 9 years ago

All excellent points.

ghost commented 9 years ago

:+1:

neuwirthe commented 9 years ago

It turns out the problem was with Safari. Somehow, Safari does not get the correct information about the page size of the printer. Things work nicely with Firefox.