Skip to content

Instantly share code, notes, and snippets.

@searls
Created August 27, 2014 18:50
Show Gist options
  • Save searls/57905a730b1e519acff1 to your computer and use it in GitHub Desktop.
Save searls/57905a730b1e519acff1 to your computer and use it in GitHub Desktop.
Delay implementing a PDF rendering feature by beating Chrome into submission instead
<%= stylesheet_link_tag "application", :media => "screen,print" %>
@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
@searls
Copy link
Author

searls commented Aug 27, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment