Force A5 Paper-size in Chrome's print settings CSS

后端 未结 2 785
遇见更好的自我
遇见更好的自我 2021-01-12 00:20

I\'ve to print out 2 html pages in a web-app. The first page must be printed out in A5 size , the second in A4 size. I tried to force the

相关标签:
2条回答
  • 2021-01-12 00:33

    Using this media query content will adjust for A5.

    @media print
    {
        @page
        {
             size: 8.5in 11in; 
        }
    }
    
    0 讨论(0)
  • 2021-01-12 00:44

    You could uset paper-css library as it will help you easily define the paper size by paper-css lib load the css file

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.3.0/paper.css">
    

    then set the style in the <head> part

    <style>@page { size: A5 }</style>
    

    then set the body class to A5 like the following

    <!-- Set "A5", "A4" or "A3" for class name -->
    <!-- Set also "landscape" if you need -->
    <body class="A5">
    
      <!-- Each sheet element should have the class "sheet" -->
      <!-- "padding-**mm" is optional: you can set 10, 15, 20 or 25 -->
      <section class="sheet padding-10mm">
    
        <!-- Write HTML just like a web page -->
        <article>This is an A5 document.</article>
    
      </section>
    
    </body>
    

    for more information follow the link below https://github.com/cognitom/paper-css

    0 讨论(0)
提交回复
热议问题