【问题标题】:How to print content fit to defined paper size?如何打印适合定义纸张尺寸的内容?
【发布时间】:2018-12-13 13:23:13
【问题描述】:

如何在 div 中显示的内容适合每一页而没有任何额外的空白页时打印得很好?

 @page {
        width: 1.97in;
        height: 1.57in;
        margin: 0;
        padding: 0;
    }
.label{
        padding: 0;
        border-collapse: collapse;
        width: 1.97in;
        height: 1.57in;
        float: left;
        display: block;
        clear: both;
        overflow: hidden;
        border-top: 1px dotted;
        page-break-after: always;
        border-bottom: 1px dotted;
    }

这是我的标签打印机设置

我想将内容打印为标签贴纸,但打印时总是显示额外的空白。如何配置?

【问题讨论】:

    标签: html css printing


    【解决方案1】:

    您可以编辑媒体打印

    @page {
        width: 1.97in;
        height: 1.57in;
        margin: 0;
        padding: 0;
    }
    @media print {
        html, body {
            width: 1.97in;
            height: 1.97in;
        }
    }
    

    【讨论】:

    • 我不是在 A4 尺寸的纸上打印,它有点像标签贴纸尺寸
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-17
    • 2016-05-01
    • 2012-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多