sonders
V2EX  ›  问与答

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

  •  
  •   sonders · Jan 10, 2022 · 1494 views
    This topic created in 1772 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
    ccyu220
    Jan 10, 2022
    1
    ```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
    ccyu220
    Jan 10, 2022
    2
    怎么复制过来变成这样了...
    vanton
    vanton
    Jan 10, 2022
    3
    @ccyu220 #2

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