简体   繁体   English

帮助在Ruby on Rails中打印网页

[英]Help in printing a webpage in Ruby on Rails

I need help with printing a webpage in Ruby Rails. 我需要帮助在Ruby Rails中打印网页。 Currently this is the code snippet that I am using 目前这是我正在使用的代码段

input type="button" id="print" onclick="javascript:print()" value="Print"

Now, when the pdf that is generated contains more than one page, is there a way to add a header to each of these pages?? 现在,当生成的pdf包含多个页面时,有没有办法为每个页面添加标题? Kindly suggest me some idea to add header to each of the page in the pdf much similar to the headers in Microsoft Word. 请建议我为pdf中的每个页面添加标题,这与Microsoft Word中的标题类似。

Here is a small code snippet that displays the data in the web page. 这是一个显示网页中数据的小代码段。

<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>"

Thanks, 谢谢,

Raja Ram 拉贾拉姆

I found this discussion. 我找到了这个讨论。 Havent tried the solutions provided. 没有尝试过提供的解决方案。 But I guess it will be useful for anyone coming to this page 但我想这对任何访问此页面的人都有用

Is there a way to get a web page header/footer printed on every page? 有没有办法在每个页面上打印网页页眉/页脚?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM