我在 html 代码中使用 window.print()。 我需要在每页上添加带有页码的新页脚,我正在使用 chrome。 我通过在打印的每一页中添加并重复新的页眉和页脚来删除默认页眉和页脚我使用带有 thead 和 tfoot 的表格样式。
我在下面附上我的代码
@page{
margin: 0; // disabling browser's header and footer
}
<table>
<thead>
header content
</thead>
<tbody>
<tr>
<td colspan="2">
<!---- dynamic contents here -->
</td>
</tr>
</tbody>
<tfoot>
footer content
</tfoot>
</table>
我需要在每一页上打印页码,它可以在 chrome 和 mozila 上工作 谢谢
最佳答案
我不相信可以配置 window.print()。根据其文档,它不接受任何参数。它利用浏览器内置的打印功能,直接打印或保存页面。
虽然浏览器 GUI 为您提供了一些打印期间屏幕上可用的选项。
关于php - 如何通过删除浏览器的默认页眉和页脚在 Chrome 的 window.print() 中的每个页面上设置页码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56986088/