Created
August 27, 2014 18:50
-
-
Save searls/57905a730b1e519acff1 to your computer and use it in GitHub Desktop.
Delay implementing a PDF rendering feature by beating Chrome into submission instead
This file contains 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
<%= stylesheet_link_tag "application", :media => "screen,print" %> |
This file contains 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
@media print | |
@page | |
margin: 6px 24px 6px 24px // make the margins so tight that user agents will not print headers/footers | |
body | |
-webkit-print-color-adjust: exact // print background colors in chrome | |
font-size: 12px // decrease size to fit more per page | |
a | |
text-decoration: none //print links as normal text | |
color: black | |
.page-break | |
page-break-after: always //anything with the class .page-break can break the page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This landed my feature with a close-enough-to-perfect print view that the users can just
Cmd-P + Save as PDF
instead of adding a server side feature to emulate the same thing