*/
// consider moving these to core...
-import {HatchService} from '@eg/share/print/hatch.service';
import {HtmlToTxtService} from '@eg/share/util/htmltotxt.service';
import {PrintService} from '@eg/share/print/print.service';
ngModule: EgCommonModule,
providers: [
HtmlToTxtService,
- HatchService,
PrintService,
ToastService
]
printQueue: PrintRequest[];
- useHatch: boolean;
-
constructor(
private renderer: Renderer2,
private elm: ElementRef,
this.htmlContainer =
this.renderer.selectRootElement('#eg-print-html-container');
-
- this.serverStore.getItem('eg.hatch.enable.printing')
- .then(use => this.useHatch = use);
}
handlePrintRequest(printReq: PrintRequest) {
show_dialog: printReq.showDialog
});
- if (this.useHatch) {
+ if (this.useHatch()) {
this.printViaHatch(printReq);
} else {
// Here the needed HTML is already in the page.
}
}
+ useHatch(): boolean {
+ return this.store.getLocalItem('eg.hatch.enable.printing')
+ && this.hatch.connect();
+ }
+
printViaHatch(printReq: PrintRequest) {
if (!printReq.contentType) {
printReq.contentType = 'text/html';