Reputation:
I have a asp.net mvc 3 view for printing a table. I would like a printable view pop-up. The resulting HTML print is compatible/formatted for 8.5x11 paper.
The entire page only contains one table, which possible has many rows. Therefore it has many pages, basically.
Export to pdf is fine.
Should I add CSS or other tricks?
<body>
<table class="ui-widget">
<thead>
<tr>
<td class="ui-widget-content">
ID
</td>
<td class="ui-widget-content">
PIN
</td>
<td class="ui-widget-content">
First Name
</td>
<td class="ui-widget-content">
Middle Name
</td>
<td class="ui-widget-content">
Last Name
</td>
</tr>
</thead>
@foreach (var r in ViewBag.PINS)
{
<tr>
<td class="ui-widget-content">@r.IDNumber
</td>
<td class="ui-widget-content">@r.PIN
</td>
<td class="ui-widget-content">@r.FirstName
</td>
<td class="ui-widget-content">@r.MiddleName
</td>
<td class="ui-widget-content">@r.LastName
</td>
</tr>
}
</table>
Upvotes: 3
Views: 1525
Reputation: 327
Have you thought about a print.css file? You can style the page then to fit on 8.5x11" (this is the easiest and fastest way). If you need it exactly right then you should use a ASP.net PDF export library.
Upvotes: 2