justinburdett / playtest

A simple ruby script system that lets you quickly prototype physical card games
8 stars 1 forks source link

Allow printing from HTML #10

Open diachini opened 10 years ago

diachini commented 10 years ago

Now that we can generate the HTML version, it'd be sweet to print right from your browser.

Useful CSS for this:

@media print {
  /* Make each page have a page-break afterward */
  .page {
    page-break-after:always;
  }

  /* ... well, except for that last one.. no reason to print paper-airplane paper */
  .page:last-child {
    page-break-after:avoid;
  }

  /* hide the printer's header & footer (in Chrome at least..) */
  @page { margin: 0; }
  body { margin: 1.6cm; }
}

However, including this CSS throws off the wkhtmltopdf conversion (and makes a much larger margin around each page). Can't deal with that any further right now.

armahillo commented 10 years ago

Has anyone tested this to see if it works? Now that the PDF generation is independent of the HTML/CSS generation, the CSS can do whatever it needs to do to make it look pretty.

justinburdett commented 10 years ago

I haven't, but I can look into it.