Skip to content

Instantly share code, notes, and snippets.

@illbzo1
Created April 23, 2014 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illbzo1/11228555 to your computer and use it in GitHub Desktop.
Save illbzo1/11228555 to your computer and use it in GitHub Desktop.
A sample template for creating PDFs with DocRaptor.
<style type="text/css">
/* setup the page */
@page {
size: US-Letter;
margin: 0 0 35mm 0;
background: #ffffff;
}
/* setup the footer */
@page {
@bottom {
content: flow(footer);
}
}
footer {
flow: static(footer);
}
body {
border-top: 10px solid #3877B1;
font-family: "myriad-pro-1", "myriad-pro-2", sans-serif;
}
#container {
margin: 0 auto;
}
header, #main {
margin: 15mm;
}
table {
width: 100%;
}
th {
font-size: 8pt;
color: #919191;
line-height: 14pt;
text-align: left;
padding-left: 10pt;
border-bottom: 1px solid #D6D6D6;
}
th:last-child, td:last-child {
width: 20%;
}
th:last-child {
padding-left: 10mm;
}
td {
padding: 10pt;
border-bottom: 1px solid #D6D6D6;
}
td h4 {
font-weight: bold;
font-size: 12pt;
}
tr:nth-child(odd) td{
background: #F1F1F1;
}
</style>
<body>
<div id="container">
<header>
<h1> Random Title </h1>
</header>
</div>
<table>
<thead>
<tr>
<th>End of year</th>
<th>Age</th>
<th>Balance</th>
<th>Withdrawal</th>
</tr>
</thead>
<tbody>
<% @withdrawal_bad_timing.each_with_index do | record, values | %>
<tr>
<% if record[:current_balance] > 0 %>
<td><%= record[:year] %> </td>
<% else %>
<td> <%= record[:year] %> </td>
<% end %>
<% if record[:current_balance] > 0 %>
<td><%= record[:age] %> </td>
<% else %>
<td><%= record[:age] %> </td>
<% end %>
<% if record[:current_balance] > 0 %>
<td><%= number_to_currency(record[:current_balance]) %> </td>
<% else %>
<td><%= number_to_currency(record[:current_balance]) %> </td>
<% end %>
<% if record[:current_balance] > 0 %>
<td><%= number_to_currency(record[:withdrawal]) %> </td>
<% else %>
<td><%= number_to_currency(record[:withdrawal]) %> </td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment