dynamicsmobile
Version:
Allows development of off-line mobile and web business apps over the Dynamics Mobile platform. More info on https://www.dynamicsmobile.com
37 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebPlatformPrinter = void 0;
const tslib_1 = require("tslib");
class WebPlatformPrinter {
constructor(dms) {
this.dms = dms;
}
print(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const win = window.open('', 'name', 'height=' + options.pageHeight * 10 + ',width=' + options.pageWidth * 10);
const doc = win.document;
let enc = options.encoding ? options.encoding : 'utf-8';
doc.write('<html><head><title>Printed document</title>');
doc.write('<meta http-equiv="Content-Type" content="text/html; charset="' + enc + '">');
doc.write('</head><body><pre>');
doc.write(options.textToPrint);
doc.write('</pre></body></html>');
doc.close();
});
}
printImage(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const win = window.open('', 'name');
const doc = win.document;
const enc = 'utf-8';
doc.write('<html><head><title>Printed document</title>');
doc.write('<meta http-equiv="Content-Type" content="text/html; charset="' + enc + '">');
doc.write('</head><body>');
doc.write(`<img src="${options.data}">`);
doc.write('</body></html>');
doc.close();
});
}
}
exports.WebPlatformPrinter = WebPlatformPrinter;
//# sourceMappingURL=dms-platform-web-printer.js.map