打印网页 printPage ● 接口说明 ● Typescript 类型参考 ● 请求参数
参数 类型 是否必填 说明 req.data String 是 需要打印的网页url地址 req.options Object 否 打印网页时的打印参数 req.options.deviceName String 否 打印机的设备名 req.options.color Boolean 否 是否彩色打印,true为彩色,false为黑白,默认为true req.options.copies Number 否 打印份数,默认为1份 req.options.dpi Number 否 打印质量,默认为300 req.options.pageRanges PageRanges[] 否 打印页数 req.options.pageRanges[index].from Number 否 起始页,index为数组序数 req.options.pageRanges[index].to Number 否 结束页,index为数组序数 req.options.margins Margins 否 边距 req.options.margins.marginType String 否 默认、无、自定义:('default' | 'none' | 'custom') req.options.margins.top Number 否 上边距 req.options.margins.right Number 否 右边距 req.options.margins.bottom Number 否 下边距 req.options.margins.left Number 否 左边距 req.options.slient Boolean 否 是否静默打印,true为静默打印 req.options.landscape Boolean 否 是否竖向打印,false为竖向,true为横向 req.options.printBackground Boolean 否 是否带背景颜色打印 req.options.headerFooter Boolean 否 是否带页头和页尾打印 req.options.scaleFactor Boolean 否 缩放大小,取值为1~100,默认为100 req.options.pageSize Boolean 否 打印纸张尺寸,取值为'A3' | 'A4' | 'A5' req.options.duplexMode String 否 双面打印,simplex为单面(默认),duplex为双面打印,duplexshort为双面打印(短边翻转),duplexlong为双面打印(长边翻转)
● 返回数据 参数 类型 必然存在 说明 res.resultCode Number 是 打印成功与否的状态码,-1 为打印失败,0 为打印成功 res.resultMessage String 是 返回是否打印成功的消息提示
● 接口示例 👆🏼测试一下
打印pdf文件 printPdf 提示
在Linux系统(信创环境)中,color属性参数无法使用,
需要预生成对应的类别(彩色或黑白)的PDF
● 接口说明 ● Typescript 类型参考 ● 请求参数 参数 类型 是否必填 说明 req.data String 是 需要打印的pdf的base64字符串 或 本地路径 或 在线url req.options Object 否 打印网页时的打印参数 req.options.deviceName String 否 打印机的设备名 req.options.color Boolean 否 是否彩色打印,true 为彩色,false 为黑白,默认为 true req.options.copies Number 否 打印份数,默认为 1 份 req.options.pageRanges PageRanges[] 否 打印页数 req.options.pageRanges[index].from Number 否 起始页,index 为数组序数 req.options.pageRanges[index].to Number 否 结束页,index 为数组序数 req.options.landscape Boolean 否 是否竖向打印,false 为竖向,true 为横向 req.options.pageSize Boolean 否 打印纸张尺寸,取值为'A3' req.options.duplexMode String 否 双面打印,simplex为单面(默认),duplex为双面打印,duplexshort为双面打印(短边翻转),duplexlong为双面打印(长边翻转)
● 返回数据 参数 类型 必然存在 说明 res.resultCode Object 是 返回调用弹窗接口的入参 res.resultMessage Boolean 是 返回点击弹窗的按钮结果
● 接口示例 👆🏼测试一下
获取打印机列表 getPrinters ● 接口说明 ● Typescript 类型参考 ● 返回数据 参数 类型 必然存在 说明 res.resultCode Number 是 接口返回的状态码 res.resultMessage Boolean 是 接口返回的信息 res.data Array 否 打印机的列表数据 res.data[index] Object 否 打印机的信息,index为数组序号 res.data[index].description String 否 打印机描述信息 res.data[index].displayName String 否 打印机展示名称 res.data[index].isDefault Boolean 否 是否为系统默认打印机 res.data[index].name String 否 打印机名称 res.data[index].options Object 否 打印机属性信息 res.data[index].status Number 否 打印机状态码
● 接口示例 👆🏼测试一下