从卷筒纸打印A4(标签纸)不会在595像素宽度上填充纸张宽度

时间:2017-03-09 11:29:36

标签: html css asp.net printing

我知道推荐的方法是使用PDF-something生成可打印的PDF,以便更好地控制输出。

但我只是想知道它是否可以完成..只使用html和css我想在这里完成的方式:

CODE - HEAD和CSS

    <html>
<head>
    <style>
        body {
            height: 842px;
            width: 595px;
            /*margin left/right - 3,81 %*/
            /*margin-left: 22.67px; margin-top: 22.67px; padding-right: -22.67px; margin-bottom: -22.67px*/
            /*label size : 28,57*/
            /*170 px*/
            /* to centre page on screen*/
            margin-left: auto;
            margin-right: auto;
        }

        .lbl {
            width: 174.8px;
            /*height: 130.3px;*/
            height: 131.7px;
            border: 1px solid purple;
            float: left;
        }

        .lbl-inner {
            padding: 3px;
            display: table-cell;
            word-break: break-all;
        }

        .spc {
            width: 8.5px;
            float: left;
        }
    </style>
</head>

代码 - HTML

<body>
<div style="border: 1px solid red; width: 100%; height: 100%">
    <div id="inner" style="margin: 22.67px; border: 1px dashed blue;">
        <div class="lbl"><span class="lbl-inner">123456789123456789123456789123456789123456789</span></div>
        <div class="spc">&nbsp;</div>
        <div class="lbl"><span class="lbl-inner">123456789123456789123456789123456789123456789</span></div>
        <div class="spc">&nbsp;</div>
        <div class="lbl"><span class="lbl-inner">123456789123456789123456789123456789123456789</span></div>

屏幕截图 - Screenview enter image description here

屏幕截图 - 打印后(纸张) enter image description here

如您所见,内容比应有的要窄得多。 针对网络的这类打印问题是否有“快速”解决方案?

0 个答案:

没有答案
相关问题