主要在两方面,增强了 printDocument 功能: 1. 对打印过程进行更精细控件,如可以指定打印机,是否双面,单张纸上打印多页等。 2.
打印pdf文件时,不需要安装任何pdf软件,这可以节约用户的成本。
printDocument(String docUrl,Object options); 
docUrl:必须为doc文件的相对地址,相对于当前打印页。
options:打印选项,每种格式,有不同的属性列表
 一、word 格式打印:
复制内容到剪贴板
代码:
printDocument("a.doc", {
 printer : "Lenovo Laser Jet 1000", // 指定打印机
 duplex : true, // 是否双面打印 true:双面/单面
 portrait : true, // 是否纵向打印,true:纵向/false:横向
 copies : 1,// 打印份数
 collate : true,// 当copies大于1时,true:按 1,2,3,... 1,2,3,...次序打印,false:
 // 1,1,2,2,3,3 ... 次序打印
 from : 1, // 起始打印页
 to : 10,// 结束打印页
 printZoomColumn : 2, // 希望 Word 在一页上水平布置的页数。 可以是 1、2、3 或 4。 与
 // printZoomRow 参数结合使用,用于在单张纸上打印多页。
 printZoomRow : 2, // 希望 Word 在一页上垂直布置的页数。 可以是 1、2 或 4。 与 printZoomColumn
 // 参数结合使用,用于在单张纸上打印多页。
 printZoomPaperWidth : 1000, // 希望 Word 将打印页缩放到的宽度(以twip表示,20 twip = 1 磅,72 磅
 // = 1 英寸)。
 printZoomPaperHeight : 1000
 // 希望 Word 将打印页缩放到的高度(以twip表示,20 twip = 1 磅,72 磅 = 1 英寸)。
 })二、excel文件打印
复制内容到剪贴板
代码:
printDocument("a.xls", "xls", {
 activePrinter : "Lenovo Laser Jet 1000", // 指定打印机
 duplex : true, // 是否双面打印 true:双面/单面
 portrait : true, // 是否纵向打印,true:纵向/false:横向
 copies : 1,// 打印份数
 collate : true,// 当copies大于1时,true:按 1,2,3,... 1,2,3,...次序打印,false:
 // 1,1,2,2,3,3 ... 次序打印
 from : 1, // 起始打印页
 to : 10// 结束打印页
 })三、powerpoint 文件打印
复制内容到剪贴板
代码:
printDocument("a.ppt",  {
 printer : "Lenovo Laser Jet 1000", // 指定打印机
 duplex : true, // 是否双面打印 true:双面/单面
 portrait : true, // 是否纵向打印,true:纵向/false:横向
 copies : 1,// 打印份数
 collate : true,// 当copies大于1时,true:按 1,2,3,... 1,2,3,...次序打印,false:
 // 1,1,2,2,3,3 ... 次序打印
 slidesPerPage : 2, // 可取值:1,2,3,4,6,9
 from : 1, // 起始打印页
 to : 10
 // 结束打印页
 })四、pdf 文件打印,不必安装任何 pdf软件
复制内容到剪贴板
代码:
printDocument("a.pdf",  {
 printer : "Lenovo Laser Jet 1000", // 指定打印机
 duplex : true, // 是否双面打印 true:双面/单面
 portrait : true, // 是否纵向打印,true:纵向/false:横向
 copies : 1,// 打印份数
 from : 1, // 起始打印页
 to : 10
 // 结束打印页
 })