dynamicsmobile
Version:
Allows development of off-line mobile and web business apps over the Dynamics Mobile platform. More info on https://www.dynamicsmobile.com
28 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackendPrintService = void 0;
const tslib_1 = require("tslib");
const injectable_1 = require("../ioc/injectable");
const print_service_1 = require("../lib-core/print-service");
let BackendPrintService = exports.BackendPrintService = class BackendPrintService extends print_service_1.PrintService {
print(options) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
//if (!options.title)
// throw new Error('PrintService.print requires argument title');
if (!options.textToPrint)
throw new Error('PrintService.print requires argument textToPrint');
const win = window.open('', 'name');
const doc = win.document;
let enc = 'utf-8';
doc.write(`<html><head><title>${"Print"}</title>
<meta http-equiv="Content-Type" content="text/html; charset="${enc}">
</head><body><pre>${options.textToPrint}</pre></body></html>`);
doc.close();
window.print();
});
}
};
exports.BackendPrintService = BackendPrintService = tslib_1.__decorate([
(0, injectable_1.Injectable)()
], BackendPrintService);
//# sourceMappingURL=backend-print-service.js.map