0

I have use below code but not working.

@page { size: A4; margin: 0; }

  • Possible duplicate of [How to set Safari print margins via CSS to print borderless](https://stackoverflow.com/questions/13154147/how-to-set-safari-print-margins-via-css-to-print-borderless) –  Apr 30 '18 at 05:01

3 Answers3

0

window.print();
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #FAFAFA;
        font: 12pt "Tahoma";
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 210mm;
        min-height: 297mm;
        padding: 20mm;
        margin: 10mm auto;
        border: 1px #D3D3D3 solid;
        border-radius: 5px;
        background: white;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    }
    .subpage {
        padding: 1cm;
        border: 5px red solid;
        height: 257mm;
        outline: 2cm #FFEAEA solid;
    }
    
    @page {
        size: A4;
        margin: 0 !important;
    }
    @media print {
        html, body {
            width: 210mm;
            height: 297mm;        
        }
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
        }
    }
<div class="book">
    <div class="page">
        <div class="subpage">Page 1/2</div>    
    </div>
    <div class="page">
        <div class="subpage">Page 2/2</div>    
    </div>
</div>

For more info - CSS to set A4 paper size

0
@media print {
    @page {
        size: A4;
        margin: 0mm;
    }
}
Krishna Soni
  • 95
  • 1
  • 9
0
@Page {
    margin: 0 -800px;
}

You have to push margin left and right as far as you need. The @Page have to be outside of "@media print".

You will probably have to re-center your content.