|
@@ -10,9 +10,49 @@ exports.__esModule = true;
|
|
|
var ffi = require("ffi");
|
|
|
var os = require("os");
|
|
|
var cpu = os.arch() === "x64" ? "64" : "86";
|
|
|
+var callback = ffi.Callback('void', ['int', 'string'], function (id, name) {
|
|
|
+ console.log("id: ", id);
|
|
|
+ console.log("name: ", name);
|
|
|
+});
|
|
|
var dll = ffi.Library(__dirname + "/dll/GetEasy.Node.Printer." + cpu + ".dll", {
|
|
|
- designerReport: ["void", ["string", "string"]],
|
|
|
+ designerReport: ["void", ["string", "string", "pointer"]],
|
|
|
reportShowPreview: ["void", ["string", "string"]],
|
|
|
reportPrinter: ["void", ["string", "string"]]
|
|
|
});
|
|
|
-exports["default"] = dll;
|
|
|
+var ReportApi = /** @class */ (function () {
|
|
|
+ function ReportApi() {
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *设计模板
|
|
|
+ *
|
|
|
+ * @param {string} fileName 模板
|
|
|
+ * @param {string} tempData 临时演示数据
|
|
|
+ * @memberof ReportApi
|
|
|
+ */
|
|
|
+ ReportApi.designerReport = function (template, tempData, saveCallback) {
|
|
|
+ var callbackPointer = ffi.Callback('bool', ['string'], saveCallback);
|
|
|
+ dll.designerReport(template, tempData, callbackPointer);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ *打印预览
|
|
|
+ *
|
|
|
+ * @param {string} fileName 模板路径
|
|
|
+ * @param {string} jsonData 数据
|
|
|
+ * @memberof ReportApi
|
|
|
+ */
|
|
|
+ ReportApi.reportShowPreview = function (fileName, jsonData) {
|
|
|
+ dll.reportPrinter(fileName, jsonData);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ *打印
|
|
|
+ *
|
|
|
+ * @param {string} fileName 模板路径
|
|
|
+ * @param {string} jsonData 数据
|
|
|
+ * @memberof ReportApi
|
|
|
+ */
|
|
|
+ ReportApi.reportPrinter = function (fileName, jsonData) {
|
|
|
+ dll.reportPrinter(fileName, jsonData);
|
|
|
+ };
|
|
|
+ return ReportApi;
|
|
|
+}());
|
|
|
+exports["default"] = ReportApi;
|