sonders
V2EX  ›  问与答

Js 如何设置谷歌浏览器打印的默认边距,纸张大小

  •  
  •   sonders · Jan 10, 2022 · 1168 views
    This topic created in 1599 days ago, the information mentioned may be changed or developed.

    如题,现在想要实现使用 JS 来自动帮用户设置好打印时的纸张大小,默认边距及缩放。
    已知,css 中 @Page { size: landscape}; 可以控制打印时的方向。

    5 replies    2022-01-10 17:25:01 +08:00
    ccyu220
        1
    ccyu220  
       Jan 10, 2022
    ```cs
    @page {
    /* pager margin */
    margin: 1cm;

    /* 1 value: height = width */
    size: 6in;

    /* 2 values: width then height */
    size: 4in 6in;

    /* Keyword values for absolute size */
    size: A4;
    }
    ```
    ccyu220
        2
    ccyu220  
       Jan 10, 2022
    怎么复制过来变成这样了...
    vanton
        3
    vanton  
       Jan 10, 2022
    @ccyu220 #2

    回复不支持代码格式化,挺难用的。
    sonders
        4
    sonders  
    OP
       Jan 10, 2022
    @ccyu220 感谢,我尝试下
    learningman
        5
    learningman  
       Jan 10, 2022 via Android
    有打印的媒体查询的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2660 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:43 · PVG 23:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.