我需要在Ruby Rails中打印网页的帮助。目前,这是我使用帮助在Ruby on Rails中打印网页
input type="button" id="print" onclick="javascript:print()" value="Print"
现在的代码片段,时生成的PDF包含多页,是有办法的头添加到这些页面的?请向我建议将标题添加到pdf中的每个页面,与Microsoft Word中的标题非常相似。
这是一个显示网页数据的小代码片段。
<fieldset>
<legend class="legend_style">Customer Details</legend>
<div class='summary_left_column'>
<table class='summary_table_style'>
<% APP_CONFIG['display_customer_items_1'].each do |key| %>
<tr>
<td> <label><%= RESOURCE_BUNDLE[key] || key %> : </label></td>
<td class="data"> <label><%= @customer[key] %></label></td>
</tr>
<%end%>
</table>
</div>
<div class='summary_right_column'>
<table class='summary_table_style'>
<% APP_CONFIG['display_customer_items_2'].each do |key| %>
<tr>
<td> <label><%= RESOURCE_BUNDLE[key] || key %> : </label></td>
<td class="data"> <label><%= @customer[key] %></label></td>
</tr>
<%end%>
</table>
</div>
</fieldset>"
感谢,
王侯公羊
的JavaScript有用:打印()打开浏览器的打印对话框 - 无关的第i个PDF。 – 2011-03-09 18:17:17
你不需要“javascript:”前缀。 – Pointy 2011-03-09 18:17:44
此外,您可以阅读CSS打印介质样式,这些样式非常酷,然后您可以研究当前浏览器支持的内容的程度,最终会感到难过。 – Pointy 2011-03-09 18:18:52