【问题标题】:print specific div using css and window.print() display on second page in pdf使用 css 打印特定的 div,window.print() 显示在 pdf 的第二页上
【发布时间】:2016-04-25 11:50:06
【问题描述】:

我的问题是我正在尝试使用 css 和 jquery 打印特定的 div,但打印输出显示在 pdf 的第二页上,我怎样才能防止我想打印该 div 从第一页而不是第二页 我使用下面的css

<style type="text/css">
    @media print{
        body * { visibility: hidden; }
        #divToPrint3 * { visibility: visible; }
        #divToPrint3 { position: fixed; top: 0px; right: 10px; }
    }
</style>

还有打印按钮html是

<a id="doPrint"  href="javascript:window.print()">
    <button class="btn btn-theme" type="button">
        <i class="fa fa-download"></i>
        print
    </button> 
</a>

请给我解决方案,在此先感谢

【问题讨论】:

  • 你能说得清楚一点吗?你想在同一个窗口上显示打印窗口??

标签: javascript jquery html css pdf


【解决方案1】:

使用display: none;,visibility: hidden; 只是隐藏元素,display: none; 不渲染元素。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    相关资源
    最近更新 更多