function SetPrintSettings() {
// -- advanced features
factory.printing.SetMarginMeasure(2) // measure margins in inches
factory.SetPageRange(false, 1, 3) // need pages from 1 to 3
factory.printing.printer = "HP DeskJet 870C"
factory.printing.copies = 2
factory.printing.collate = true
factory.printing.paperSize = "A4"
factory.printing.paperSource = "Manual feed"
// -- basic features
factory.printing.header = "This is MeadCo"
factory.printing.footer = "Advanced Printing by ScriptX"
factory.printing.portrait = false
factory.printing.leftMargin = 1.0
factory.printing.topMargin = 1.0
factory.printing.rightMargin = 1.0
factory.printing.bottomMargin = 1.0
}
相信处理过web打印的你,对这段代码一定不陌生吧,呵呵,不错,这段就是国外的Scriptx控件的处理打印的js脚本。
用过的人一定知道,其实上面那段代码中,只有
// -- basic features
factory.printing.header = "This is MeadCo"
factory.printing.footer = "Advanced Printing by ScriptX"
factory.printing.portrait = false
factory.printing.leftMargin = 1.0
factory.printing.topMargin = 1.0
factory.printing.rightMargin = 1.0
factory.printing.bottomMargin = 1.0
这些是可以使用的,就是说这些属性才是scriptx的试用版本免费提供的。就是说,可以设置页眉页脚;设置打印方向是横向还是纵向;设置四个页边距。这几个属性是基本的功能,可以免费试用。
// -- advanced features
factory.printing.SetMarginMeasure(2) // measure margins in inches
factory.SetPageRange(false, 1, 3) // need pages from 1 to 3
factory.printing.printer = "HP DeskJet 870C"
factory.printing.copies = 2
factory.printing.collate = true
factory.printing.paperSize = "A4"
factory.printing.paperSource = "Manual feed"
上面这些属性是scriptx控件的高级功能,是不能免费使用的。就是说,在没有购买正式版的时候,不能指定打印机;不能设置打印纸张;设置打印份数等等。如果放置到代码中是会出错的。eprint自定义打印工具中包含的类似scriptx的小插件,在试用版本中能使用所有的低高级功能。
不知道这样会出错的代码,为什么还有那么多人去转载?