首页 > 解决方案 > 从 HTML 转换为 pdf 时如何将页码添加到固定页脚(通过使用 css 或 js)?

问题描述

我创建了 html,它在转换为 pdf 后有 6 页。我有固定的页脚,想在那里添加页码。我已经尝试了我找到的所有代码 @page{@bottom: content :counter(page)} 并且它不起作用我也尝试编写 js 代码但它也不起作用。

footer{
    position:fixed;
    z-index:1;
    bottom:0;
    font-size:11px;
    background-color: white;
    color:#A2A2A2;
    padding-left: 80px;
    padding-right: 60px;
    width:910px;
    box-sizing: border-box}
<footer>
  <table id="footer" class="t_f1 pf">
    <tbody>
      <tr >
        <td width="280" align="left">some text</td>
        <td width="450" align="right">some text</td>
      </tr>
      <tr>
        <td class="section" align="left">some text</td>
        <td align="right">Page number </td>
      </tr>
    </tbody>
  </table>  
</footer>   

您知道如何在此页脚中添加页码吗?感谢您的任何回复

标签: javascripthtmljquerycsspagination

解决方案


推荐阅读