可以在javascript中强制打印机设置(纸张尺寸)吗? [英] Possible to force printer setup (paper size) in javascript?

查看:112
本文介绍了可以在javascript中强制打印机设置(纸张尺寸)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将网页从 Web 应用程序打印到 8" x 4" 索引卡上.IE 不会将打印设置从一个打印保存到下一个,那么有没有办法以编程方式强制打印设置?

I have a need to print pages from a web app on to 8" x 4" index cards. IE doesn't save print settings from one print to the next, so is there a way to programmatically force the print set up?

推荐答案

看看这个来自 http://www.w3.org/TR/css3-page/#size:

/* style sheet for "A4" printing */
@media print and (width: 21cm) and (height: 29.7cm) {
     @page {
        margin: 3cm;
     }
}

/* style sheet for "letter" printing */
@media print and (width: 8.5in) and (height: 11in) {
    @page {
        margin: 1in;
    }
}

/* A4 Landscape*/
@page {
    size: A4 landscape;
    margin: 10%;
}

这篇关于可以在javascript中强制打印机设置(纸张尺寸)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆