@icreate/ics-chromely-plugin-core
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -349,6 +349,28 @@ import { LogLevels } from '@icreate/core'; | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-12-13 13:43:25 | ||
* @LastEditTime: 2022-12-13 15:13:33 | ||
* @Description: | ||
* @FilePath: \ics-chromely-plugin-core\src\core\printer.ts | ||
*/ | ||
var Duplex; | ||
(function (Duplex) { | ||
// | ||
// 摘要: | ||
// The printer's default duplex setting. | ||
Duplex[Duplex["Default"] = -1] = "Default"; | ||
// | ||
// 摘要: | ||
// Single-sided printing. | ||
Duplex[Duplex["Simplex"] = 1] = "Simplex"; | ||
// | ||
// 摘要: | ||
// Double-sided, vertical printing. | ||
Duplex[Duplex["Vertical"] = 2] = "Vertical"; | ||
// | ||
// 摘要: | ||
// Double-sided, horizontal printing. | ||
Duplex[Duplex["Horizontal"] = 3] = "Horizontal"; | ||
})(Duplex || (Duplex = {})); | ||
/** | ||
* 打印类 | ||
*/ | ||
var Printer = /** @class */ (function () { | ||
@@ -368,7 +390,27 @@ function Printer() { | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机列表 | ||
* @returns ["Microsoft Print to PDF"],第一个打印机是默认打印机 | ||
*/ | ||
Printer.getPrinterList = function () { | ||
return this.OperateEx('List'); | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机对象列表 | ||
* @returns | ||
* [{ | ||
* "Name": "Microsoft Print to PDF", //打印机名称 | ||
* "IsDefault": true, //是否默认打印机 | ||
* "IsDuplex": false //是否支持双面打印 | ||
* }, | ||
* { | ||
* "Name": "Fax", | ||
* "IsDefault": false, | ||
* "IsDuplex": false | ||
* }] | ||
*/ | ||
Printer.getPrinterListEx = function () { | ||
return this.OperateEx('ListEx'); | ||
}; | ||
// 获取本地默认打印机 | ||
Printer.getPrinterDefault = function () { | ||
@@ -382,7 +424,16 @@ return this.OperateEx('Default'); | ||
/** | ||
* 打印pdf流 | ||
* @param blob 流 | ||
* 打印pdf内容 | ||
* @param bytes 二进制内容 | ||
*/ | ||
Printer.printPdf = function (bytes) { | ||
return this.OperateEx('PrintPdf', bytes, "POST", { 'Content-Type': 'application/pdf' }); | ||
Printer.printPdf = function (bytes, settings) { | ||
if (settings === void 0) { settings = null; } | ||
var params = [], url = 'PrintPdf'; | ||
// 如果有打印设置则拼接url参数 | ||
if (settings) { | ||
for (var key in settings) { | ||
params.push(key + '=' + settings[key]); | ||
} | ||
url = url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
return this.OperateEx(url, bytes, 'POST', { 'Content-Type': 'application/pdf' }); | ||
}; | ||
@@ -389,0 +440,0 @@ return Printer; |
@@ -356,6 +356,28 @@ (function (global, factory) { | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-12-13 13:43:25 | ||
* @LastEditTime: 2022-12-13 15:13:33 | ||
* @Description: | ||
* @FilePath: \ics-chromely-plugin-core\src\core\printer.ts | ||
*/ | ||
var Duplex; | ||
(function (Duplex) { | ||
// | ||
// 摘要: | ||
// The printer's default duplex setting. | ||
Duplex[Duplex["Default"] = -1] = "Default"; | ||
// | ||
// 摘要: | ||
// Single-sided printing. | ||
Duplex[Duplex["Simplex"] = 1] = "Simplex"; | ||
// | ||
// 摘要: | ||
// Double-sided, vertical printing. | ||
Duplex[Duplex["Vertical"] = 2] = "Vertical"; | ||
// | ||
// 摘要: | ||
// Double-sided, horizontal printing. | ||
Duplex[Duplex["Horizontal"] = 3] = "Horizontal"; | ||
})(Duplex || (Duplex = {})); | ||
/** | ||
* 打印类 | ||
*/ | ||
var Printer = /** @class */ (function () { | ||
@@ -375,7 +397,27 @@ function Printer() { | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机列表 | ||
* @returns ["Microsoft Print to PDF"],第一个打印机是默认打印机 | ||
*/ | ||
Printer.getPrinterList = function () { | ||
return this.OperateEx('List'); | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机对象列表 | ||
* @returns | ||
* [{ | ||
* "Name": "Microsoft Print to PDF", //打印机名称 | ||
* "IsDefault": true, //是否默认打印机 | ||
* "IsDuplex": false //是否支持双面打印 | ||
* }, | ||
* { | ||
* "Name": "Fax", | ||
* "IsDefault": false, | ||
* "IsDuplex": false | ||
* }] | ||
*/ | ||
Printer.getPrinterListEx = function () { | ||
return this.OperateEx('ListEx'); | ||
}; | ||
// 获取本地默认打印机 | ||
Printer.getPrinterDefault = function () { | ||
@@ -389,7 +431,16 @@ return this.OperateEx('Default'); | ||
/** | ||
* 打印pdf流 | ||
* @param blob 流 | ||
* 打印pdf内容 | ||
* @param bytes 二进制内容 | ||
*/ | ||
Printer.printPdf = function (bytes) { | ||
return this.OperateEx('PrintPdf', bytes, "POST", { 'Content-Type': 'application/pdf' }); | ||
Printer.printPdf = function (bytes, settings) { | ||
if (settings === void 0) { settings = null; } | ||
var params = [], url = 'PrintPdf'; | ||
// 如果有打印设置则拼接url参数 | ||
if (settings) { | ||
for (var key in settings) { | ||
params.push(key + '=' + settings[key]); | ||
} | ||
url = url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
return this.OperateEx(url, bytes, 'POST', { 'Content-Type': 'application/pdf' }); | ||
}; | ||
@@ -396,0 +447,0 @@ return Printer; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PrinterSettings = void 0; | ||
/* | ||
@@ -7,3 +8,3 @@ * @Author: 刘邓 | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-12-13 13:43:25 | ||
* @LastEditTime: 2022-12-13 15:13:33 | ||
* @Description: | ||
@@ -13,2 +14,33 @@ * @FilePath: \ics-chromely-plugin-core\src\core\printer.ts | ||
var ics_chromely_js_sdk_1 = require("@icreate/ics-chromely-js-sdk"); | ||
var Duplex; | ||
(function (Duplex) { | ||
// | ||
// 摘要: | ||
// The printer's default duplex setting. | ||
Duplex[Duplex["Default"] = -1] = "Default"; | ||
// | ||
// 摘要: | ||
// Single-sided printing. | ||
Duplex[Duplex["Simplex"] = 1] = "Simplex"; | ||
// | ||
// 摘要: | ||
// Double-sided, vertical printing. | ||
Duplex[Duplex["Vertical"] = 2] = "Vertical"; | ||
// | ||
// 摘要: | ||
// Double-sided, horizontal printing. | ||
Duplex[Duplex["Horizontal"] = 3] = "Horizontal"; | ||
})(Duplex || (Duplex = {})); | ||
/** | ||
* 打印设置 | ||
*/ | ||
var PrinterSettings = /** @class */ (function () { | ||
function PrinterSettings() { | ||
} | ||
return PrinterSettings; | ||
}()); | ||
exports.PrinterSettings = PrinterSettings; | ||
/** | ||
* 打印类 | ||
*/ | ||
var Printer = /** @class */ (function () { | ||
@@ -28,7 +60,27 @@ function Printer() { | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机列表 | ||
* @returns ["Microsoft Print to PDF"],第一个打印机是默认打印机 | ||
*/ | ||
Printer.getPrinterList = function () { | ||
return this.OperateEx('List'); | ||
}; | ||
// 获取本地打印机列表 | ||
/** | ||
* 获取本地打印机对象列表 | ||
* @returns | ||
* [{ | ||
* "Name": "Microsoft Print to PDF", //打印机名称 | ||
* "IsDefault": true, //是否默认打印机 | ||
* "IsDuplex": false //是否支持双面打印 | ||
* }, | ||
* { | ||
* "Name": "Fax", | ||
* "IsDefault": false, | ||
* "IsDuplex": false | ||
* }] | ||
*/ | ||
Printer.getPrinterListEx = function () { | ||
return this.OperateEx('ListEx'); | ||
}; | ||
// 获取本地默认打印机 | ||
Printer.getPrinterDefault = function () { | ||
@@ -42,7 +94,16 @@ return this.OperateEx('Default'); | ||
/** | ||
* 打印pdf流 | ||
* @param blob 流 | ||
* 打印pdf内容 | ||
* @param bytes 二进制内容 | ||
*/ | ||
Printer.printPdf = function (bytes) { | ||
return this.OperateEx('PrintPdf', bytes, "POST", { 'Content-Type': 'application/pdf' }); | ||
Printer.printPdf = function (bytes, settings) { | ||
if (settings === void 0) { settings = null; } | ||
var params = [], url = 'PrintPdf'; | ||
// 如果有打印设置则拼接url参数 | ||
if (settings) { | ||
for (var key in settings) { | ||
params.push(key + '=' + settings[key]); | ||
} | ||
url = url + (params.length > 0 ? "?".concat(params.join('&')) : ''); | ||
} | ||
return this.OperateEx(url, bytes, 'POST', { 'Content-Type': 'application/pdf' }); | ||
}; | ||
@@ -49,0 +110,0 @@ return Printer; |
@@ -0,11 +1,73 @@ | ||
declare enum Duplex { | ||
Default = -1, | ||
Simplex = 1, | ||
Vertical = 2, | ||
Horizontal = 3 | ||
} | ||
/** | ||
* 打印设置 | ||
*/ | ||
export declare class PrinterSettings { | ||
/** | ||
* 打印机名称 | ||
*/ | ||
printerName: string; | ||
/** | ||
* 打印文档名称 | ||
*/ | ||
documentName: string; | ||
/** | ||
* 打印纸张名 | ||
*/ | ||
paperName: string; | ||
/** | ||
* 打印副本数 | ||
*/ | ||
copies: number; | ||
/** | ||
* 双面打印设置 | ||
*/ | ||
duplex: Duplex; | ||
/** | ||
*自定义纸张宽度 | ||
*/ | ||
customWidth: number; | ||
/** | ||
* 自定义纸张高度 | ||
*/ | ||
customHeight: number; | ||
} | ||
/** | ||
* 打印类 | ||
*/ | ||
export default class Printer { | ||
private static OperateEx; | ||
/** | ||
* 获取本地打印机列表 | ||
* @returns ["Microsoft Print to PDF"],第一个打印机是默认打印机 | ||
*/ | ||
static getPrinterList(): Promise<any>; | ||
/** | ||
* 获取本地打印机对象列表 | ||
* @returns | ||
* [{ | ||
* "Name": "Microsoft Print to PDF", //打印机名称 | ||
* "IsDefault": true, //是否默认打印机 | ||
* "IsDuplex": false //是否支持双面打印 | ||
* }, | ||
* { | ||
* "Name": "Fax", | ||
* "IsDefault": false, | ||
* "IsDuplex": false | ||
* }] | ||
*/ | ||
static getPrinterListEx(): Promise<any>; | ||
static getPrinterDefault(): Promise<any>; | ||
static isPrinterExists(printerName: string): Promise<any>; | ||
/** | ||
* 打印pdf流 | ||
* @param blob 流 | ||
* 打印pdf内容 | ||
* @param bytes 二进制内容 | ||
*/ | ||
static printPdf(bytes: ArrayBuffer): Promise<any>; | ||
static printPdf(bytes: ArrayBuffer, settings?: PrinterSettings | null): Promise<any>; | ||
} | ||
export {}; |
{ | ||
"name": "@icreate/ics-chromely-plugin-core", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "提供Ics Chromely Client核心本地操作插件js sdk,包含本地日志、主窗体控制、打开三方浏览器、打印机列表、硬件IP和Mac地址、本地配置获取和注册表读写等", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -5,3 +5,3 @@ <!-- | ||
* @LastEditors: 陶慧灵 | ||
* @LastEditTime: 2022-11-22 12:47:09 | ||
* @LastEditTime: 2022-12-13 15:05:17 | ||
* @Descripttion: | ||
@@ -17,2 +17,5 @@ * @FilePath: \ics-chromely-plugin-core\README.md | ||
``` | ||
0.0.20 增加获取打印机列表扩展方法 | ||
0.0.19-beta.1 增加pdf打印设置 | ||
0.0.19 增加pdf打印 | ||
0.0.18-beta7 新增获取本机Ip和Mac地址列表方法`getIpMacAddress` | ||
@@ -165,5 +168,19 @@ 0.0.18-beta6 修复注册表调用方法对应路由 | ||
getPrinterList(): Promise<array> | ||
// 获取本地打印机列表 | ||
// 获取本地打印机对象列表 | ||
// Ex: [ | ||
// { | ||
// "Name": "HP LaserJet Pro MFP M225-M226 PCL 6", //打印机名称 | ||
// "IsDefault": false, //是否默认打印机 | ||
// "IsDuplex": true //是否支持双面打印 | ||
// } | ||
// { | ||
// "Name": "Microsoft Print to PDF", | ||
// "IsDefault": true, | ||
// "IsDuplex": false | ||
// } | ||
// ] | ||
getPrinterListEx(): Promise<array> | ||
// 获取本地打印机列表 | ||
getPrinterDefault(): Promise<string> | ||
// 判断指定打印机名称是否存在 | ||
// 判断指定打印机名称是否存在 | ||
isPrinterExists(printerName: string): Promise<bool> | ||
@@ -170,0 +187,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175955
2736
205