ngx-print 22.0.0 → 22.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/fesm2022/ngx-print.mjs +64 -114
- package/fesm2022/ngx-print.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-print.d.ts +31 -66
- package/types/ngx-print.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,14 @@ export class PrintExampleComponent {}
|
|
|
102
102
|
|
|
103
103
|
Here some simple styles were added to every `h1` & `h2` tags within the `div` where `print-section` is tagged to its `id` attribute.
|
|
104
104
|
|
|
105
|
+
`printStyle` also accepts a raw CSS string, which is injected into the print document's `<style>` tag as-is. This is useful for anything the object form can't express well, such as multiple selectors per rule, media queries, or `!important`:
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<button printStyle="h1, h2 { color: red; } @media print { .no-print { display: none; } }"
|
|
109
|
+
printSectionId="print-section"
|
|
110
|
+
ngxPrint>print</button>
|
|
111
|
+
```
|
|
112
|
+
|
|
105
113
|
- If you would like to use your existing CSS with media print you can add the `useExistingCss` attribute:
|
|
106
114
|
|
|
107
115
|
```html
|
|
@@ -247,6 +255,9 @@ printDelay: number = 0;
|
|
|
247
255
|
// Optional: CSS as a key-value pair
|
|
248
256
|
this.printService.printStyle = styleSheet;
|
|
249
257
|
|
|
258
|
+
// Optional: CSS as a raw string
|
|
259
|
+
this.printService.printStyle = 'h1, h2 { color: red; }';
|
|
260
|
+
|
|
250
261
|
// Optional: path to a CSS file
|
|
251
262
|
this.printService.styleSheetFile = fileLocation;
|
|
252
263
|
```
|
package/fesm2022/ngx-print.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DOCUMENT, CSP_NONCE,
|
|
2
|
+
import { inject, DOCUMENT, CSP_NONCE, Service, input, output, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { Subject, take } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
class PrintOptions {
|
|
@@ -29,26 +29,32 @@ class PrintBase {
|
|
|
29
29
|
/**
|
|
30
30
|
* Sets the print styles based on the provided values.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
32
|
+
* @param values - Either a key-value pairs object representing print styles, or a raw CSS string.
|
|
33
33
|
* @protected
|
|
34
34
|
*/
|
|
35
35
|
setPrintStyle(values) {
|
|
36
|
+
if (typeof values === 'string') {
|
|
37
|
+
this._printStyle = values ? [values] : [];
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
36
40
|
this._printStyle = [];
|
|
37
|
-
for (const
|
|
38
|
-
|
|
41
|
+
for (const [selector, declarations] of Object.entries(values)) {
|
|
42
|
+
// Built declaration-by-declaration (rather than via JSON.stringify + a quote-stripping
|
|
43
|
+
// regex) so that quotes and commas that are part of a CSS value (e.g. quoted font names,
|
|
44
|
+
// comma-separated font-family fallback lists) survive instead of being stripped/mangled.
|
|
45
|
+
const body = Object.entries(declarations)
|
|
46
|
+
.map(([property, value]) => `${property}:${value}`)
|
|
47
|
+
.join(';');
|
|
48
|
+
this._printStyle.push(`${selector}{${body}}`);
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
51
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
52
|
* @returns the string that create the stylesheet which will be injected
|
|
45
53
|
* later within <style></style> tag.
|
|
46
|
-
*
|
|
47
|
-
* -join/replace to transform an array objects to css-styled string
|
|
48
54
|
*/
|
|
49
55
|
returnStyleValues() {
|
|
50
56
|
const styleNonce = this.nonce ? ` nonce="${this.nonce}"` : '';
|
|
51
|
-
return `<style${styleNonce}> ${this._printStyle.join(' ')
|
|
57
|
+
return `<style${styleNonce}> ${this._printStyle.join(' ')} </style>`;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
60
|
* @returns string which contains the link tags containing the css which will
|
|
@@ -66,6 +72,10 @@ class PrintBase {
|
|
|
66
72
|
*/
|
|
67
73
|
// prettier-ignore
|
|
68
74
|
setStyleSheetFile(cssList) {
|
|
75
|
+
if (!cssList) {
|
|
76
|
+
this._styleSheetFile = '';
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
69
79
|
const files = cssList.split(',').map(f => f.trim());
|
|
70
80
|
const nonceAttr = this.nonce ? ` nonce="${this.nonce}"` : '';
|
|
71
81
|
this._styleSheetFile = files
|
|
@@ -172,7 +182,7 @@ class PrintBase {
|
|
|
172
182
|
const cloneElm = sourceElm.cloneNode(true); // cloneNode(true) deep clones subtree
|
|
173
183
|
this.syncFormValues(sourceElm, cloneElm);
|
|
174
184
|
this.updateCanvasToImage(sourceElm, cloneElm);
|
|
175
|
-
return cloneElm.
|
|
185
|
+
return cloneElm.outerHTML;
|
|
176
186
|
}
|
|
177
187
|
/**
|
|
178
188
|
* Retrieves the HTML content of elements with the specified tag.
|
|
@@ -333,108 +343,71 @@ class PrintBase {
|
|
|
333
343
|
doc.appendChild(html);
|
|
334
344
|
return true;
|
|
335
345
|
}
|
|
336
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: PrintBase, deps: [], target: i0.ɵɵFactoryTarget.
|
|
337
|
-
static ɵprov = i0.ɵɵ
|
|
346
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: PrintBase, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
347
|
+
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.2", ngImport: i0, type: PrintBase });
|
|
338
348
|
}
|
|
339
349
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: PrintBase, decorators: [{
|
|
340
|
-
type:
|
|
341
|
-
args: [{
|
|
342
|
-
providedIn: 'root',
|
|
343
|
-
}]
|
|
350
|
+
type: Service
|
|
344
351
|
}] });
|
|
345
352
|
|
|
346
353
|
class NgxPrintDirective extends PrintBase {
|
|
347
|
-
printOptions = new PrintOptions();
|
|
348
354
|
/**
|
|
349
355
|
* Prevents the print dialog from opening on the window
|
|
350
|
-
*
|
|
351
|
-
* @memberof NgxPrintDirective
|
|
352
|
-
*/
|
|
353
|
-
set previewOnly(value) {
|
|
354
|
-
this.printOptions = { ...this.printOptions, previewOnly: value };
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* @memberof NgxPrintDirective
|
|
360
|
-
*/
|
|
361
|
-
set printSectionId(value) {
|
|
362
|
-
this.printOptions = { ...this.printOptions, printSectionId: value };
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
* @memberof NgxPrintDirective
|
|
368
|
-
*/
|
|
369
|
-
set printTitle(value) {
|
|
370
|
-
this.printOptions = { ...this.printOptions, printTitle: value };
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* @memberof NgxPrintDirective
|
|
376
356
|
*/
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
357
|
+
previewOnly = input(false, /* @ts-ignore */
|
|
358
|
+
...(ngDevMode ? [{ debugName: "previewOnly" }] : /* istanbul ignore next */ []));
|
|
359
|
+
printSectionId = input('', /* @ts-ignore */
|
|
360
|
+
...(ngDevMode ? [{ debugName: "printSectionId" }] : /* istanbul ignore next */ []));
|
|
361
|
+
printTitle = input('', /* @ts-ignore */
|
|
362
|
+
...(ngDevMode ? [{ debugName: "printTitle" }] : /* istanbul ignore next */ []));
|
|
363
|
+
useExistingCss = input(false, /* @ts-ignore */
|
|
364
|
+
...(ngDevMode ? [{ debugName: "useExistingCss" }] : /* istanbul ignore next */ []));
|
|
380
365
|
/**
|
|
381
366
|
* A delay in milliseconds to force the print dialog to wait before opened. Default: 0
|
|
382
|
-
*
|
|
383
|
-
* @memberof NgxPrintDirective
|
|
384
367
|
*/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
368
|
+
printDelay = input(0, /* @ts-ignore */
|
|
369
|
+
...(ngDevMode ? [{ debugName: "printDelay" }] : /* istanbul ignore next */ []));
|
|
388
370
|
/**
|
|
389
371
|
* Whether to close the window after print() returns.
|
|
390
|
-
*
|
|
391
372
|
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
373
|
+
closeWindow = input(true, /* @ts-ignore */
|
|
374
|
+
...(ngDevMode ? [{ debugName: "closeWindow" }] : /* istanbul ignore next */ []));
|
|
395
375
|
/**
|
|
396
376
|
* Class attribute to apply to the body element.
|
|
397
|
-
*
|
|
398
377
|
*/
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
378
|
+
bodyClass = input('', /* @ts-ignore */
|
|
379
|
+
...(ngDevMode ? [{ debugName: "bodyClass" }] : /* istanbul ignore next */ []));
|
|
402
380
|
/**
|
|
403
381
|
* Which PrintMethod (iframe/window/tab) to use.
|
|
404
|
-
*
|
|
405
|
-
*/
|
|
406
|
-
set printMethod(value) {
|
|
407
|
-
this.printOptions = { ...this.printOptions, printMethod: value };
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* @memberof NgxPrintDirective
|
|
413
|
-
*/
|
|
414
|
-
set printStyle(values) {
|
|
415
|
-
super.setPrintStyle(values);
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @memberof NgxPrintDirective
|
|
419
|
-
* @param cssList
|
|
420
|
-
*/
|
|
421
|
-
set styleSheetFile(cssList) {
|
|
422
|
-
super.setStyleSheetFile(cssList);
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* @memberof NgxPrintDirective
|
|
428
382
|
*/
|
|
383
|
+
printMethod = input('window', /* @ts-ignore */
|
|
384
|
+
...(ngDevMode ? [{ debugName: "printMethod" }] : /* istanbul ignore next */ []));
|
|
385
|
+
printStyle = input({}, /* @ts-ignore */
|
|
386
|
+
...(ngDevMode ? [{ debugName: "printStyle" }] : /* istanbul ignore next */ []));
|
|
387
|
+
styleSheetFile = input('', /* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [{ debugName: "styleSheetFile" }] : /* istanbul ignore next */ []));
|
|
389
|
+
printCompleted = output();
|
|
429
390
|
print() {
|
|
430
|
-
|
|
391
|
+
// Inputs carry side effects on PrintBase's internal style state, so they're applied
|
|
392
|
+
// synchronously here rather than via effect() (effects shouldn't propagate state).
|
|
393
|
+
super.setPrintStyle(this.printStyle());
|
|
394
|
+
super.setStyleSheetFile(this.styleSheetFile());
|
|
395
|
+
super.print({
|
|
396
|
+
printSectionId: this.printSectionId(),
|
|
397
|
+
printTitle: this.printTitle(),
|
|
398
|
+
useExistingCss: this.useExistingCss(),
|
|
399
|
+
bodyClass: this.bodyClass(),
|
|
400
|
+
printMethod: this.printMethod(),
|
|
401
|
+
previewOnly: this.previewOnly(),
|
|
402
|
+
closeWindow: this.closeWindow(),
|
|
403
|
+
printDelay: this.printDelay(),
|
|
404
|
+
});
|
|
431
405
|
this.printComplete.pipe(take(1)).subscribe(() => {
|
|
432
406
|
this.printCompleted.emit();
|
|
433
407
|
});
|
|
434
408
|
}
|
|
435
|
-
printCompleted = output();
|
|
436
409
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
437
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
410
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: NgxPrintDirective, isStandalone: true, selector: "[ngxPrint]", inputs: { previewOnly: { classPropertyName: "previewOnly", publicName: "previewOnly", isSignal: true, isRequired: false, transformFunction: null }, printSectionId: { classPropertyName: "printSectionId", publicName: "printSectionId", isSignal: true, isRequired: false, transformFunction: null }, printTitle: { classPropertyName: "printTitle", publicName: "printTitle", isSignal: true, isRequired: false, transformFunction: null }, useExistingCss: { classPropertyName: "useExistingCss", publicName: "useExistingCss", isSignal: true, isRequired: false, transformFunction: null }, printDelay: { classPropertyName: "printDelay", publicName: "printDelay", isSignal: true, isRequired: false, transformFunction: null }, closeWindow: { classPropertyName: "closeWindow", publicName: "closeWindow", isSignal: true, isRequired: false, transformFunction: null }, bodyClass: { classPropertyName: "bodyClass", publicName: "bodyClass", isSignal: true, isRequired: false, transformFunction: null }, printMethod: { classPropertyName: "printMethod", publicName: "printMethod", isSignal: true, isRequired: false, transformFunction: null }, printStyle: { classPropertyName: "printStyle", publicName: "printStyle", isSignal: true, isRequired: false, transformFunction: null }, styleSheetFile: { classPropertyName: "styleSheetFile", publicName: "styleSheetFile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { printCompleted: "printCompleted" }, host: { listeners: { "click": "print()" } }, usesInheritance: true, ngImport: i0 });
|
|
438
411
|
}
|
|
439
412
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintDirective, decorators: [{
|
|
440
413
|
type: Directive,
|
|
@@ -445,27 +418,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImpor
|
|
|
445
418
|
'(click)': 'print()',
|
|
446
419
|
},
|
|
447
420
|
}]
|
|
448
|
-
}], propDecorators: { previewOnly: [{
|
|
449
|
-
type: Input
|
|
450
|
-
}], printSectionId: [{
|
|
451
|
-
type: Input
|
|
452
|
-
}], printTitle: [{
|
|
453
|
-
type: Input
|
|
454
|
-
}], useExistingCss: [{
|
|
455
|
-
type: Input
|
|
456
|
-
}], printDelay: [{
|
|
457
|
-
type: Input
|
|
458
|
-
}], closeWindow: [{
|
|
459
|
-
type: Input
|
|
460
|
-
}], bodyClass: [{
|
|
461
|
-
type: Input
|
|
462
|
-
}], printMethod: [{
|
|
463
|
-
type: Input
|
|
464
|
-
}], printStyle: [{
|
|
465
|
-
type: Input
|
|
466
|
-
}], styleSheetFile: [{
|
|
467
|
-
type: Input
|
|
468
|
-
}], printCompleted: [{ type: i0.Output, args: ["printCompleted"] }] } });
|
|
421
|
+
}], propDecorators: { previewOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewOnly", required: false }] }], printSectionId: [{ type: i0.Input, args: [{ isSignal: true, alias: "printSectionId", required: false }] }], printTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "printTitle", required: false }] }], useExistingCss: [{ type: i0.Input, args: [{ isSignal: true, alias: "useExistingCss", required: false }] }], printDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "printDelay", required: false }] }], closeWindow: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeWindow", required: false }] }], bodyClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "bodyClass", required: false }] }], printMethod: [{ type: i0.Input, args: [{ isSignal: true, alias: "printMethod", required: false }] }], printStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "printStyle", required: false }] }], styleSheetFile: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleSheetFile", required: false }] }], printCompleted: [{ type: i0.Output, args: ["printCompleted"] }] } });
|
|
469
422
|
|
|
470
423
|
class NgxPrintModule {
|
|
471
424
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -504,7 +457,7 @@ class NgxPrintService extends PrintBase {
|
|
|
504
457
|
/**
|
|
505
458
|
* Sets the print style for the printing process.
|
|
506
459
|
*
|
|
507
|
-
* @param
|
|
460
|
+
* @param values - Either a dictionary representing the print styles, or a raw CSS string.
|
|
508
461
|
* @memberof NgxPrintService
|
|
509
462
|
* @setter
|
|
510
463
|
*/
|
|
@@ -521,14 +474,11 @@ class NgxPrintService extends PrintBase {
|
|
|
521
474
|
set styleSheetFile(cssList) {
|
|
522
475
|
super.setStyleSheetFile(cssList);
|
|
523
476
|
}
|
|
524
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintService, deps:
|
|
525
|
-
static ɵprov = i0.ɵɵ
|
|
477
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
478
|
+
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintService });
|
|
526
479
|
}
|
|
527
480
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: NgxPrintService, decorators: [{
|
|
528
|
-
type:
|
|
529
|
-
args: [{
|
|
530
|
-
providedIn: 'root',
|
|
531
|
-
}]
|
|
481
|
+
type: Service
|
|
532
482
|
}] });
|
|
533
483
|
|
|
534
484
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-print.mjs","sources":["../../../src/lib/print-options.ts","../../../src/lib/ngx-print.base.ts","../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/lib/ngx-print.service.ts","../../../src/public_api.ts","../../../src/ngx-print.ts"],"sourcesContent":["export class PrintOptions {\r\n printSectionId = '';\r\n printTitle = '';\r\n useExistingCss = false;\r\n bodyClass = '';\r\n printMethod: 'window' | 'tab' | 'iframe' = 'window';\r\n previewOnly = false;\r\n closeWindow = true;\r\n printDelay = 0;\r\n\r\n constructor(options?: Partial<PrintOptions>) {\r\n if (options) {\r\n Object.assign(this, options);\r\n }\r\n }\r\n}\r\n","import { CSP_NONCE, DOCUMENT, inject, Injectable } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { PrintOptions } from './print-options';\r\n\r\n/** For example:\r\n * {\r\n * 'h2': { 'border': 'solid 1px' },\r\n * 'h1': { 'color': 'red', 'border': '1px solid' },\r\n * */\r\nexport type PrintStyle = Record<string, Record<string, string>>;\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PrintBase {\r\n private document = inject(DOCUMENT);\r\n private nonce = inject(CSP_NONCE, { optional: true });\r\n\r\n private _iframeElement: HTMLIFrameElement | undefined;\r\n private _printStyle: string[] = [];\r\n private _styleSheetFile = '';\r\n protected printComplete = new Subject<void>();\r\n\r\n //#region Getters and Setters\r\n /**\r\n * Sets the print styles based on the provided values.\r\n *\r\n * @param {Object} values - Key-value pairs representing print styles.\r\n * @protected\r\n */\r\n protected setPrintStyle(values: PrintStyle) {\r\n this._printStyle = [];\r\n for (const key of Object.keys(values)) {\r\n this._printStyle.push((key + JSON.stringify(values[key])).replace(/['\"]+/g, ''));\r\n }\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @returns the string that create the stylesheet which will be injected\r\n * later within <style></style> tag.\r\n *\r\n * -join/replace to transform an array objects to css-styled string\r\n */\r\n public returnStyleValues(): string {\r\n const styleNonce = this.nonce ? ` nonce=\"${this.nonce}\"` : '';\r\n return `<style${styleNonce}> ${this._printStyle.join(' ').replace(/,/g, ';')} </style>`;\r\n }\r\n\r\n /**\r\n * @returns string which contains the link tags containing the css which will\r\n * be injected later within <head></head> tag.\r\n *\r\n */\r\n private returnStyleSheetLinkTags(): string {\r\n return this._styleSheetFile;\r\n }\r\n\r\n /**\r\n * Sets the style sheet file based on the provided CSS list.\r\n *\r\n * @param {string} cssList - CSS file or list of CSS files.\r\n * @protected\r\n */\r\n // prettier-ignore\r\n protected setStyleSheetFile(cssList: string): void {\r\n const files = cssList.split(',').map(f => f.trim());\r\n const nonceAttr = this.nonce ? ` nonce=\"${this.nonce}\"` : '';\r\n this._styleSheetFile = files\r\n .map(url => `<link${nonceAttr} rel=\"stylesheet\" type=\"text/css\" href=\"${url}\">`)\r\n .join('');\r\n }\r\n\r\n //#endregion\r\n\r\n //#region Private methods used by PrintBase\r\n\r\n private syncFormValues(source: HTMLElement, clone: HTMLElement): void {\r\n // Select all form elements\r\n const selector = 'input, select, textarea';\r\n const sourceEls = source.querySelectorAll(selector);\r\n const cloneEls = clone.querySelectorAll(selector);\r\n\r\n for (let i = 0; i < sourceEls.length; i++) {\r\n const srcNode = sourceEls[i] as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n const cloneNode = cloneEls[i] as typeof srcNode;\r\n\r\n if (srcNode instanceof HTMLInputElement) {\r\n if (srcNode.type === 'checkbox' || srcNode.type === 'radio') {\r\n if (srcNode.checked) cloneNode.setAttribute('checked', '');\r\n else cloneNode.removeAttribute('checked'); // Remove if unchecked\r\n } else if (srcNode.type === 'file') {\r\n // File inputs can't be set programmatically for security\r\n continue;\r\n } else {\r\n cloneNode.setAttribute('value', srcNode.value);\r\n }\r\n } else if (srcNode instanceof HTMLTextAreaElement) {\r\n cloneNode.textContent = srcNode.value; // Use textContent, not innerHTML\r\n } else if (srcNode instanceof HTMLSelectElement) {\r\n Array.from((cloneNode as HTMLSelectElement).options).forEach((opt, idx) => {\r\n if (idx === srcNode.selectedIndex) {\r\n opt.setAttribute('selected', '');\r\n } else {\r\n opt.removeAttribute('selected'); // Remove from non-selected\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Converts a canvas element to an image and returns its HTML string.\r\n *\r\n * @param {HTMLCanvasElement} canvasElm - The canvas element to convert.\r\n * @returns {HTMLImageElement | null} - HTML Element of the image.\r\n * @private\r\n */\r\n private canvasToImageHtml(canvasElm: HTMLCanvasElement): HTMLImageElement | null {\r\n try {\r\n const dataUrl = canvasElm.toDataURL(); // may throw if canvas is tainted\r\n const img = this.document.createElement('img');\r\n img.src = dataUrl;\r\n img.style.maxWidth = '100%';\r\n\r\n // Preserve displayed size (not just bitmap size)\r\n const rect = canvasElm.getBoundingClientRect();\r\n if (rect.width) img.style.width = `${rect.width}px`;\r\n if (rect.height) img.style.height = `${rect.height}px`;\r\n\r\n return img;\r\n } catch (err) {\r\n console.warn(`Canvas conversion failed for ${canvasElm}. Likely the canvas is tainted:`, err);\r\n // If toDataURL() fails (e.g., tainted canvas), keep canvas as-is in print output\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Includes canvas contents in the print section via img tags.\r\n *\r\n * @private\r\n * @param source\r\n * @param clone\r\n */\r\n private updateCanvasToImage(source: HTMLElement, clone: HTMLElement): void {\r\n const sourceCanvases = source.querySelectorAll('canvas');\r\n const cloneCanvases = clone.querySelectorAll('canvas');\r\n\r\n for (let i = 0; i < sourceCanvases.length; i++) {\r\n const srcCanvas = sourceCanvases[i];\r\n const cloneCanvas = cloneCanvases[i];\r\n const img = this.canvasToImageHtml(srcCanvas);\r\n if (img) {\r\n cloneCanvas.replaceWith(img);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of a specified printing section.\r\n *\r\n * @param {string} printSectionId - Id of the printing section.\r\n * @returns {string | null} - HTML content of the printing section, or null if not found.\r\n * @private\r\n */\r\n private getHtmlContents(printSectionId: string): string | null {\r\n const sourceElm = this.document.getElementById(printSectionId);\r\n if (!sourceElm) return null;\r\n\r\n const cloneElm = sourceElm.cloneNode(true) as HTMLElement; // cloneNode(true) deep clones subtree\r\n\r\n this.syncFormValues(sourceElm, cloneElm);\r\n this.updateCanvasToImage(sourceElm, cloneElm);\r\n\r\n return cloneElm.innerHTML;\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of elements with the specified tag.\r\n *\r\n * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.\r\n * @returns {string} - Concatenated outerHTML of elements with the specified tag.\r\n * @private\r\n */\r\n private getElementTag(tag: keyof HTMLElementTagNameMap): string {\r\n const html: string[] = [];\r\n const elements = this.document.getElementsByTagName(tag);\r\n for (const el of Array.from(elements)) {\r\n html.push((el as Element).outerHTML);\r\n }\r\n return html.join('\\r\\n');\r\n }\r\n\r\n //#endregion\r\n\r\n protected notifyPrintComplete() {\r\n this.printComplete.next();\r\n }\r\n\r\n /**\r\n * Prints the specified content using the provided print options.\r\n *\r\n * @public\r\n * @param printOptionInput - Options for printing.\r\n */\r\n protected print(printOptionInput?: Partial<PrintOptions>): void {\r\n const printOptions = new PrintOptions(printOptionInput);\r\n if (printOptions.printMethod === 'iframe') {\r\n this.printWithIframe(printOptions);\r\n } else {\r\n this.printWithWindow(printOptions);\r\n }\r\n }\r\n\r\n protected printWithWindow(printOptions: PrintOptions) {\r\n // If the openNewTab option is set to true, then set the popOut option to an empty string\r\n // This will cause the print dialog to open in a new tab.\r\n const popOut = printOptions.printMethod === 'tab' ? '' : 'top=0,left=0,height=auto,width=auto';\r\n\r\n const popupWin = window.open('', '_blank', popOut);\r\n\r\n if (!popupWin) {\r\n // the popup window could not be opened.\r\n console.error('Could not open print window.');\r\n return;\r\n }\r\n\r\n popupWin.document.open();\r\n // Create the HTML structure\r\n this.buildPrintDocument(popupWin.document, printOptions);\r\n\r\n popupWin.document.close();\r\n\r\n // Listen for the window closing\r\n const checkClosedInterval = setInterval(() => {\r\n if (popupWin.closed) {\r\n clearInterval(checkClosedInterval);\r\n this.notifyPrintComplete();\r\n }\r\n }, 500);\r\n\r\n popupWin.addEventListener('load', () => {\r\n if (!printOptions.previewOnly) {\r\n setTimeout(() => {\r\n popupWin.print();\r\n if (printOptions.closeWindow) popupWin.close();\r\n }, printOptions.printDelay || 0);\r\n }\r\n });\r\n }\r\n\r\n private printWithIframe(printOptions: PrintOptions): void {\r\n if (this._iframeElement) {\r\n this._iframeElement.remove();\r\n }\r\n this._iframeElement = this.document.createElement('iframe');\r\n const iframe = this._iframeElement;\r\n iframe.id = 'print-iframe-' + new Date().getTime();\r\n iframe.style.position = 'absolute';\r\n iframe.style.left = '-9999px';\r\n iframe.style.top = '-9999px';\r\n iframe.style.width = '0px';\r\n iframe.style.height = '0px';\r\n iframe.ariaHidden = 'true';\r\n\r\n this.document.body.appendChild(iframe);\r\n\r\n const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;\r\n if (!iframeDoc) {\r\n console.error('Could not access iframe document.');\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n\r\n iframeDoc.open();\r\n const success = this.buildPrintDocument(iframeDoc, printOptions);\r\n if (!success) {\r\n iframeDoc.close();\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n iframeDoc.close();\r\n\r\n iframe.onload = () => {\r\n const printWindow = iframe.contentWindow;\r\n if (!printWindow) {\r\n console.error('Could not access iframe window.');\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n\r\n setTimeout(() => {\r\n if (printOptions.previewOnly) {\r\n return;\r\n }\r\n printWindow.focus();\r\n printWindow.print();\r\n\r\n const mediaQueryList = printWindow.matchMedia('print');\r\n const listener = (mql: MediaQueryListEvent) => {\r\n if (!mql.matches) {\r\n this.notifyPrintComplete();\r\n mediaQueryList.removeEventListener('change', listener);\r\n }\r\n };\r\n\r\n mediaQueryList.addEventListener('change', listener);\r\n }, printOptions.printDelay || 0);\r\n };\r\n }\r\n\r\n private prepareDocumentComponents(printOptions: PrintOptions) {\r\n let styles = '';\r\n let links = '';\r\n const baseTag = this.getElementTag('base');\r\n\r\n if (printOptions.useExistingCss) {\r\n styles = this.getElementTag('style');\r\n links = this.getElementTag('link');\r\n }\r\n\r\n const printContents = this.getHtmlContents(printOptions.printSectionId);\r\n\r\n return { styles, links, baseTag, printContents };\r\n }\r\n\r\n private buildPrintDocument(doc: Document, printOptions: PrintOptions): boolean {\r\n const components = this.prepareDocumentComponents(printOptions);\r\n\r\n if (!components.printContents) {\r\n console.error(`Print section with id \"${printOptions.printSectionId}\" not found.`);\r\n return false;\r\n }\r\n\r\n const html = doc.createElement('html');\r\n const head = doc.createElement('head');\r\n const body = doc.createElement('body');\r\n\r\n // Set title\r\n const title = doc.createElement('title');\r\n title.textContent = printOptions.printTitle || '';\r\n head.appendChild(title);\r\n\r\n // Add all head content\r\n if (components.baseTag) {\r\n head.innerHTML += components.baseTag;\r\n }\r\n head.innerHTML += this.returnStyleValues();\r\n head.innerHTML += this.returnStyleSheetLinkTags();\r\n head.innerHTML += components.styles;\r\n head.innerHTML += components.links;\r\n\r\n // Set body class and content\r\n if (printOptions.bodyClass) body.className = printOptions.bodyClass;\r\n body.innerHTML += components.printContents;\r\n\r\n // Assemble document\r\n html.appendChild(head);\r\n html.appendChild(body);\r\n doc.appendChild(html);\r\n\r\n return true;\r\n }\r\n}\r\n","import { Directive, Input, output } from '@angular/core';\r\nimport { PrintBase, PrintStyle } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\nimport { take } from 'rxjs';\r\n\r\n@Directive({\r\n selector: '[ngxPrint]',\r\n standalone: true,\r\n host: {\r\n '(click)': 'print()',\r\n },\r\n})\r\nexport class NgxPrintDirective extends PrintBase {\r\n private printOptions = new PrintOptions();\r\n\r\n /**\r\n * Prevents the print dialog from opening on the window\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set previewOnly(value: boolean) {\r\n this.printOptions = { ...this.printOptions, previewOnly: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printSectionId(value: string) {\r\n this.printOptions = { ...this.printOptions, printSectionId: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printTitle(value: string) {\r\n this.printOptions = { ...this.printOptions, printTitle: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set useExistingCss(value: boolean) {\r\n this.printOptions = { ...this.printOptions, useExistingCss: value };\r\n }\r\n\r\n /**\r\n * A delay in milliseconds to force the print dialog to wait before opened. Default: 0\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printDelay(value: number) {\r\n this.printOptions = { ...this.printOptions, printDelay: value };\r\n }\r\n\r\n /**\r\n * Whether to close the window after print() returns.\r\n *\r\n */\r\n @Input() set closeWindow(value: boolean) {\r\n this.printOptions = { ...this.printOptions, closeWindow: value };\r\n }\r\n\r\n /**\r\n * Class attribute to apply to the body element.\r\n *\r\n */\r\n @Input() set bodyClass(value: string) {\r\n this.printOptions = { ...this.printOptions, bodyClass: value };\r\n }\r\n\r\n /**\r\n * Which PrintMethod (iframe/window/tab) to use.\r\n *\r\n */\r\n @Input() set printMethod(value: typeof PrintOptions.prototype.printMethod) {\r\n this.printOptions = { ...this.printOptions, printMethod: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input()\r\n set printStyle(values: PrintStyle) {\r\n super.setPrintStyle(values);\r\n }\r\n\r\n /**\r\n * @memberof NgxPrintDirective\r\n * @param cssList\r\n */\r\n @Input()\r\n set styleSheetFile(cssList: string) {\r\n super.setStyleSheetFile(cssList);\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n public override print(): void {\r\n super.print(this.printOptions);\r\n this.printComplete.pipe(take(1)).subscribe(() => {\r\n this.printCompleted.emit();\r\n });\r\n }\r\n\r\n readonly printCompleted = output<void>();\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { NgxPrintDirective } from './ngx-print.directive';\r\n\r\n@NgModule({\r\n imports: [NgxPrintDirective],\r\n exports: [NgxPrintDirective],\r\n})\r\nexport class NgxPrintModule {}\r\n","import { Injectable } from '@angular/core';\r\nimport { PrintBase, PrintStyle } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\n\r\n/**\r\n * Service for handling printing functionality in Angular applications.\r\n * Extends the base printing class (PrintBase).\r\n *\r\n * @export\r\n * @class NgxPrintService\r\n * @extends {PrintBase}\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class NgxPrintService extends PrintBase {\r\n printComplete$ = this.printComplete.asObservable();\r\n\r\n /**\r\n * Initiates the printing process using the provided print options.\r\n *\r\n * @param {PrintOptions} printOptions - Options for configuring the printing process.\r\n * @memberof NgxPrintService\r\n * @returns {void}\r\n */\r\n public override print(printOptions?: Partial<PrintOptions>): void {\r\n // Call the print method in the parent class\r\n super.print(printOptions);\r\n }\r\n\r\n /**\r\n * Sets the print style for the printing process.\r\n *\r\n * @param {{ [key: string]: { [key: string]: string } }} values - A dictionary representing the print styles.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set printStyle(values: PrintStyle) {\r\n super.setPrintStyle(values);\r\n }\r\n\r\n /**\r\n * Sets the stylesheet file for the printing process.\r\n *\r\n * @param {string} cssList - A string representing the path to the stylesheet file.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set styleSheetFile(cssList: string) {\r\n super.setStyleSheetFile(cssList);\r\n }\r\n}\r\n","/*\r\n * Public API Surface of ngx-print\r\n */\r\nexport { NgxPrintDirective } from './lib/ngx-print.directive';\r\nexport { NgxPrintModule } from './lib/ngx-print.module';\r\nexport { NgxPrintService } from './lib/ngx-print.service';\r\nexport { PrintOptions } from './lib/print-options';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAAa,YAAY,CAAA;IACvB,cAAc,GAAG,EAAE;IACnB,UAAU,GAAG,EAAE;IACf,cAAc,GAAG,KAAK;IACtB,SAAS,GAAG,EAAE;IACd,WAAW,GAAgC,QAAQ;IACnD,WAAW,GAAG,KAAK;IACnB,WAAW,GAAG,IAAI;IAClB,UAAU,GAAG,CAAC;AAEd,IAAA,WAAA,CAAY,OAA+B,EAAA;QACzC,IAAI,OAAO,EAAE;AACX,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QAC9B;IACF;AACD;;MCDY,SAAS,CAAA;AACZ,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC3B,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE7C,IAAA,cAAc;IACd,WAAW,GAAa,EAAE;IAC1B,eAAe,GAAG,EAAE;AAClB,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG7C;;;;;AAKG;AACO,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CAAC,YAAY,EAAE;AAElD;;;;;;AAMG;AACa,IAAA,KAAK,CAAC,YAAoC,EAAA;;AAExD,QAAA,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC;IAC3B;AAEA;;;;;;AAMG;IACH,IAAI,UAAU,CAAC,MAAkB,EAAA;AAC/B,QAAA,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC;IAC7B;AAEA;;;;;;AAMG;IACH,IAAI,cAAc,CAAC,OAAe,EAAA;AAChC,QAAA,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC;IAClC;uGAnCW,eAAe,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA;;2FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACdD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-print.mjs","sources":["../../../src/lib/print-options.ts","../../../src/lib/ngx-print.base.ts","../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/lib/ngx-print.service.ts","../../../src/public_api.ts","../../../src/ngx-print.ts"],"sourcesContent":["export class PrintOptions {\r\n printSectionId = '';\r\n printTitle = '';\r\n useExistingCss = false;\r\n bodyClass = '';\r\n printMethod: 'window' | 'tab' | 'iframe' = 'window';\r\n previewOnly = false;\r\n closeWindow = true;\r\n printDelay = 0;\r\n\r\n constructor(options?: Partial<PrintOptions>) {\r\n if (options) {\r\n Object.assign(this, options);\r\n }\r\n }\r\n}\r\n","import { CSP_NONCE, DOCUMENT, inject, Service } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { PrintOptions } from './print-options';\r\n\r\n/** For example:\r\n * {\r\n * 'h2': { 'border': 'solid 1px' },\r\n * 'h1': { 'color': 'red', 'border': '1px solid' },\r\n * */\r\nexport type PrintStyle = Record<string, Record<string, string>>;\r\n\r\n/**\r\n * Either a {@link PrintStyle} object, or a raw CSS string (e.g. `'h1 { color: red; }'`)\r\n * to be injected into the print document's <style> tag as-is.\r\n */\r\nexport type PrintStyleInput = PrintStyle | string;\r\n\r\n@Service()\r\nexport class PrintBase {\r\n private document = inject(DOCUMENT);\r\n private nonce = inject(CSP_NONCE, { optional: true });\r\n\r\n private _iframeElement: HTMLIFrameElement | undefined;\r\n private _printStyle: string[] = [];\r\n private _styleSheetFile = '';\r\n protected printComplete = new Subject<void>();\r\n\r\n //#region Getters and Setters\r\n /**\r\n * Sets the print styles based on the provided values.\r\n *\r\n * @param values - Either a key-value pairs object representing print styles, or a raw CSS string.\r\n * @protected\r\n */\r\n protected setPrintStyle(values: PrintStyleInput) {\r\n if (typeof values === 'string') {\r\n this._printStyle = values ? [values] : [];\r\n return;\r\n }\r\n\r\n this._printStyle = [];\r\n for (const [selector, declarations] of Object.entries(values)) {\r\n // Built declaration-by-declaration (rather than via JSON.stringify + a quote-stripping\r\n // regex) so that quotes and commas that are part of a CSS value (e.g. quoted font names,\r\n // comma-separated font-family fallback lists) survive instead of being stripped/mangled.\r\n const body = Object.entries(declarations)\r\n .map(([property, value]) => `${property}:${value}`)\r\n .join(';');\r\n this._printStyle.push(`${selector}{${body}}`);\r\n }\r\n }\r\n\r\n /**\r\n * @returns the string that create the stylesheet which will be injected\r\n * later within <style></style> tag.\r\n */\r\n public returnStyleValues(): string {\r\n const styleNonce = this.nonce ? ` nonce=\"${this.nonce}\"` : '';\r\n return `<style${styleNonce}> ${this._printStyle.join(' ')} </style>`;\r\n }\r\n\r\n /**\r\n * @returns string which contains the link tags containing the css which will\r\n * be injected later within <head></head> tag.\r\n *\r\n */\r\n private returnStyleSheetLinkTags(): string {\r\n return this._styleSheetFile;\r\n }\r\n\r\n /**\r\n * Sets the style sheet file based on the provided CSS list.\r\n *\r\n * @param {string} cssList - CSS file or list of CSS files.\r\n * @protected\r\n */\r\n // prettier-ignore\r\n protected setStyleSheetFile(cssList: string): void {\r\n if (!cssList) {\r\n this._styleSheetFile = '';\r\n return;\r\n }\r\n const files = cssList.split(',').map(f => f.trim());\r\n const nonceAttr = this.nonce ? ` nonce=\"${this.nonce}\"` : '';\r\n this._styleSheetFile = files\r\n .map(url => `<link${nonceAttr} rel=\"stylesheet\" type=\"text/css\" href=\"${url}\">`)\r\n .join('');\r\n }\r\n\r\n //#endregion\r\n\r\n //#region Private methods used by PrintBase\r\n\r\n private syncFormValues(source: HTMLElement, clone: HTMLElement): void {\r\n // Select all form elements\r\n const selector = 'input, select, textarea';\r\n const sourceEls = source.querySelectorAll(selector);\r\n const cloneEls = clone.querySelectorAll(selector);\r\n\r\n for (let i = 0; i < sourceEls.length; i++) {\r\n const srcNode = sourceEls[i] as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n const cloneNode = cloneEls[i] as typeof srcNode;\r\n\r\n if (srcNode instanceof HTMLInputElement) {\r\n if (srcNode.type === 'checkbox' || srcNode.type === 'radio') {\r\n if (srcNode.checked) cloneNode.setAttribute('checked', '');\r\n else cloneNode.removeAttribute('checked'); // Remove if unchecked\r\n } else if (srcNode.type === 'file') {\r\n // File inputs can't be set programmatically for security\r\n continue;\r\n } else {\r\n cloneNode.setAttribute('value', srcNode.value);\r\n }\r\n } else if (srcNode instanceof HTMLTextAreaElement) {\r\n cloneNode.textContent = srcNode.value; // Use textContent, not innerHTML\r\n } else if (srcNode instanceof HTMLSelectElement) {\r\n Array.from((cloneNode as HTMLSelectElement).options).forEach((opt, idx) => {\r\n if (idx === srcNode.selectedIndex) {\r\n opt.setAttribute('selected', '');\r\n } else {\r\n opt.removeAttribute('selected'); // Remove from non-selected\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Converts a canvas element to an image and returns its HTML string.\r\n *\r\n * @param {HTMLCanvasElement} canvasElm - The canvas element to convert.\r\n * @returns {HTMLImageElement | null} - HTML Element of the image.\r\n * @private\r\n */\r\n private canvasToImageHtml(canvasElm: HTMLCanvasElement): HTMLImageElement | null {\r\n try {\r\n const dataUrl = canvasElm.toDataURL(); // may throw if canvas is tainted\r\n const img = this.document.createElement('img');\r\n img.src = dataUrl;\r\n img.style.maxWidth = '100%';\r\n\r\n // Preserve displayed size (not just bitmap size)\r\n const rect = canvasElm.getBoundingClientRect();\r\n if (rect.width) img.style.width = `${rect.width}px`;\r\n if (rect.height) img.style.height = `${rect.height}px`;\r\n\r\n return img;\r\n } catch (err) {\r\n console.warn(`Canvas conversion failed for ${canvasElm}. Likely the canvas is tainted:`, err);\r\n // If toDataURL() fails (e.g., tainted canvas), keep canvas as-is in print output\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Includes canvas contents in the print section via img tags.\r\n *\r\n * @private\r\n * @param source\r\n * @param clone\r\n */\r\n private updateCanvasToImage(source: HTMLElement, clone: HTMLElement): void {\r\n const sourceCanvases = source.querySelectorAll('canvas');\r\n const cloneCanvases = clone.querySelectorAll('canvas');\r\n\r\n for (let i = 0; i < sourceCanvases.length; i++) {\r\n const srcCanvas = sourceCanvases[i];\r\n const cloneCanvas = cloneCanvases[i];\r\n const img = this.canvasToImageHtml(srcCanvas);\r\n if (img) {\r\n cloneCanvas.replaceWith(img);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of a specified printing section.\r\n *\r\n * @param {string} printSectionId - Id of the printing section.\r\n * @returns {string | null} - HTML content of the printing section, or null if not found.\r\n * @private\r\n */\r\n private getHtmlContents(printSectionId: string): string | null {\r\n const sourceElm = this.document.getElementById(printSectionId);\r\n if (!sourceElm) return null;\r\n\r\n const cloneElm = sourceElm.cloneNode(true) as HTMLElement; // cloneNode(true) deep clones subtree\r\n\r\n this.syncFormValues(sourceElm, cloneElm);\r\n this.updateCanvasToImage(sourceElm, cloneElm);\r\n\r\n return cloneElm.outerHTML;\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of elements with the specified tag.\r\n *\r\n * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.\r\n * @returns {string} - Concatenated outerHTML of elements with the specified tag.\r\n * @private\r\n */\r\n private getElementTag(tag: keyof HTMLElementTagNameMap): string {\r\n const html: string[] = [];\r\n const elements = this.document.getElementsByTagName(tag);\r\n for (const el of Array.from(elements)) {\r\n html.push((el as Element).outerHTML);\r\n }\r\n return html.join('\\r\\n');\r\n }\r\n\r\n //#endregion\r\n\r\n protected notifyPrintComplete() {\r\n this.printComplete.next();\r\n }\r\n\r\n /**\r\n * Prints the specified content using the provided print options.\r\n *\r\n * @public\r\n * @param printOptionInput - Options for printing.\r\n */\r\n protected print(printOptionInput?: Partial<PrintOptions>): void {\r\n const printOptions = new PrintOptions(printOptionInput);\r\n if (printOptions.printMethod === 'iframe') {\r\n this.printWithIframe(printOptions);\r\n } else {\r\n this.printWithWindow(printOptions);\r\n }\r\n }\r\n\r\n protected printWithWindow(printOptions: PrintOptions) {\r\n // If the openNewTab option is set to true, then set the popOut option to an empty string\r\n // This will cause the print dialog to open in a new tab.\r\n const popOut = printOptions.printMethod === 'tab' ? '' : 'top=0,left=0,height=auto,width=auto';\r\n\r\n const popupWin = window.open('', '_blank', popOut);\r\n\r\n if (!popupWin) {\r\n // the popup window could not be opened.\r\n console.error('Could not open print window.');\r\n return;\r\n }\r\n\r\n popupWin.document.open();\r\n // Create the HTML structure\r\n this.buildPrintDocument(popupWin.document, printOptions);\r\n\r\n popupWin.document.close();\r\n\r\n // Listen for the window closing\r\n const checkClosedInterval = setInterval(() => {\r\n if (popupWin.closed) {\r\n clearInterval(checkClosedInterval);\r\n this.notifyPrintComplete();\r\n }\r\n }, 500);\r\n\r\n popupWin.addEventListener('load', () => {\r\n if (!printOptions.previewOnly) {\r\n setTimeout(() => {\r\n popupWin.print();\r\n if (printOptions.closeWindow) popupWin.close();\r\n }, printOptions.printDelay || 0);\r\n }\r\n });\r\n }\r\n\r\n private printWithIframe(printOptions: PrintOptions): void {\r\n if (this._iframeElement) {\r\n this._iframeElement.remove();\r\n }\r\n this._iframeElement = this.document.createElement('iframe');\r\n const iframe = this._iframeElement;\r\n iframe.id = 'print-iframe-' + new Date().getTime();\r\n iframe.style.position = 'absolute';\r\n iframe.style.left = '-9999px';\r\n iframe.style.top = '-9999px';\r\n iframe.style.width = '0px';\r\n iframe.style.height = '0px';\r\n iframe.ariaHidden = 'true';\r\n\r\n this.document.body.appendChild(iframe);\r\n\r\n const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;\r\n if (!iframeDoc) {\r\n console.error('Could not access iframe document.');\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n\r\n iframeDoc.open();\r\n const success = this.buildPrintDocument(iframeDoc, printOptions);\r\n if (!success) {\r\n iframeDoc.close();\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n iframeDoc.close();\r\n\r\n iframe.onload = () => {\r\n const printWindow = iframe.contentWindow;\r\n if (!printWindow) {\r\n console.error('Could not access iframe window.');\r\n this.document.body.removeChild(iframe);\r\n return;\r\n }\r\n\r\n setTimeout(() => {\r\n if (printOptions.previewOnly) {\r\n return;\r\n }\r\n printWindow.focus();\r\n printWindow.print();\r\n\r\n const mediaQueryList = printWindow.matchMedia('print');\r\n const listener = (mql: MediaQueryListEvent) => {\r\n if (!mql.matches) {\r\n this.notifyPrintComplete();\r\n mediaQueryList.removeEventListener('change', listener);\r\n }\r\n };\r\n\r\n mediaQueryList.addEventListener('change', listener);\r\n }, printOptions.printDelay || 0);\r\n };\r\n }\r\n\r\n private prepareDocumentComponents(printOptions: PrintOptions) {\r\n let styles = '';\r\n let links = '';\r\n const baseTag = this.getElementTag('base');\r\n\r\n if (printOptions.useExistingCss) {\r\n styles = this.getElementTag('style');\r\n links = this.getElementTag('link');\r\n }\r\n\r\n const printContents = this.getHtmlContents(printOptions.printSectionId);\r\n\r\n return { styles, links, baseTag, printContents };\r\n }\r\n\r\n private buildPrintDocument(doc: Document, printOptions: PrintOptions): boolean {\r\n const components = this.prepareDocumentComponents(printOptions);\r\n\r\n if (!components.printContents) {\r\n console.error(`Print section with id \"${printOptions.printSectionId}\" not found.`);\r\n return false;\r\n }\r\n\r\n const html = doc.createElement('html');\r\n const head = doc.createElement('head');\r\n const body = doc.createElement('body');\r\n\r\n // Set title\r\n const title = doc.createElement('title');\r\n title.textContent = printOptions.printTitle || '';\r\n head.appendChild(title);\r\n\r\n // Add all head content\r\n if (components.baseTag) {\r\n head.innerHTML += components.baseTag;\r\n }\r\n head.innerHTML += this.returnStyleValues();\r\n head.innerHTML += this.returnStyleSheetLinkTags();\r\n head.innerHTML += components.styles;\r\n head.innerHTML += components.links;\r\n\r\n // Set body class and content\r\n if (printOptions.bodyClass) body.className = printOptions.bodyClass;\r\n body.innerHTML += components.printContents;\r\n\r\n // Assemble document\r\n html.appendChild(head);\r\n html.appendChild(body);\r\n doc.appendChild(html);\r\n\r\n return true;\r\n }\r\n}\r\n","import { Directive, input, output } from '@angular/core';\r\nimport { PrintBase, PrintStyleInput } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\nimport { take } from 'rxjs';\r\n\r\n@Directive({\r\n selector: '[ngxPrint]',\r\n standalone: true,\r\n host: {\r\n '(click)': 'print()',\r\n },\r\n})\r\nexport class NgxPrintDirective extends PrintBase {\r\n /**\r\n * Prevents the print dialog from opening on the window\r\n */\r\n readonly previewOnly = input(false);\r\n\r\n readonly printSectionId = input('');\r\n\r\n readonly printTitle = input('');\r\n\r\n readonly useExistingCss = input(false);\r\n\r\n /**\r\n * A delay in milliseconds to force the print dialog to wait before opened. Default: 0\r\n */\r\n readonly printDelay = input(0);\r\n\r\n /**\r\n * Whether to close the window after print() returns.\r\n */\r\n readonly closeWindow = input(true);\r\n\r\n /**\r\n * Class attribute to apply to the body element.\r\n */\r\n readonly bodyClass = input('');\r\n\r\n /**\r\n * Which PrintMethod (iframe/window/tab) to use.\r\n */\r\n readonly printMethod = input<PrintOptions['printMethod']>('window');\r\n\r\n readonly printStyle = input<PrintStyleInput>({});\r\n\r\n readonly styleSheetFile = input('');\r\n\r\n readonly printCompleted = output<void>();\r\n\r\n public override print(): void {\r\n // Inputs carry side effects on PrintBase's internal style state, so they're applied\r\n // synchronously here rather than via effect() (effects shouldn't propagate state).\r\n super.setPrintStyle(this.printStyle());\r\n super.setStyleSheetFile(this.styleSheetFile());\r\n\r\n super.print({\r\n printSectionId: this.printSectionId(),\r\n printTitle: this.printTitle(),\r\n useExistingCss: this.useExistingCss(),\r\n bodyClass: this.bodyClass(),\r\n printMethod: this.printMethod(),\r\n previewOnly: this.previewOnly(),\r\n closeWindow: this.closeWindow(),\r\n printDelay: this.printDelay(),\r\n });\r\n\r\n this.printComplete.pipe(take(1)).subscribe(() => {\r\n this.printCompleted.emit();\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { NgxPrintDirective } from './ngx-print.directive';\r\n\r\n@NgModule({\r\n imports: [NgxPrintDirective],\r\n exports: [NgxPrintDirective],\r\n})\r\nexport class NgxPrintModule {}\r\n","import { Service } from '@angular/core';\r\nimport { PrintBase, PrintStyleInput } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\n\r\n/**\r\n * Service for handling printing functionality in Angular applications.\r\n * Extends the base printing class (PrintBase).\r\n *\r\n * @export\r\n * @class NgxPrintService\r\n * @extends {PrintBase}\r\n */\r\n@Service()\r\nexport class NgxPrintService extends PrintBase {\r\n printComplete$ = this.printComplete.asObservable();\r\n\r\n /**\r\n * Initiates the printing process using the provided print options.\r\n *\r\n * @param {PrintOptions} printOptions - Options for configuring the printing process.\r\n * @memberof NgxPrintService\r\n * @returns {void}\r\n */\r\n public override print(printOptions?: Partial<PrintOptions>): void {\r\n // Call the print method in the parent class\r\n super.print(printOptions);\r\n }\r\n\r\n /**\r\n * Sets the print style for the printing process.\r\n *\r\n * @param values - Either a dictionary representing the print styles, or a raw CSS string.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set printStyle(values: PrintStyleInput) {\r\n super.setPrintStyle(values);\r\n }\r\n\r\n /**\r\n * Sets the stylesheet file for the printing process.\r\n *\r\n * @param {string} cssList - A string representing the path to the stylesheet file.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set styleSheetFile(cssList: string) {\r\n super.setStyleSheetFile(cssList);\r\n }\r\n}\r\n","/*\r\n * Public API Surface of ngx-print\r\n */\r\nexport { NgxPrintDirective } from './lib/ngx-print.directive';\r\nexport { NgxPrintModule } from './lib/ngx-print.module';\r\nexport { NgxPrintService } from './lib/ngx-print.service';\r\nexport { PrintOptions } from './lib/print-options';\r\nexport { PrintStyle, PrintStyleInput } from './lib/ngx-print.base';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAAa,YAAY,CAAA;IACvB,cAAc,GAAG,EAAE;IACnB,UAAU,GAAG,EAAE;IACf,cAAc,GAAG,KAAK;IACtB,SAAS,GAAG,EAAE;IACd,WAAW,GAAgC,QAAQ;IACnD,WAAW,GAAG,KAAK;IACnB,WAAW,GAAG,IAAI;IAClB,UAAU,GAAG,CAAC;AAEd,IAAA,WAAA,CAAY,OAA+B,EAAA;QACzC,IAAI,OAAO,EAAE;AACX,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QAC9B;IACF;AACD;;MCGY,SAAS,CAAA;AACZ,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC3B,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE7C,IAAA,cAAc;IACd,WAAW,GAAa,EAAE;IAC1B,eAAe,GAAG,EAAE;AAClB,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG7C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AAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAf,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B;;;ACZD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
package/types/ngx-print.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
2
|
import * as rxjs from 'rxjs';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
|
|
@@ -20,6 +20,11 @@ declare class PrintOptions {
|
|
|
20
20
|
* 'h1': { 'color': 'red', 'border': '1px solid' },
|
|
21
21
|
* */
|
|
22
22
|
type PrintStyle = Record<string, Record<string, string>>;
|
|
23
|
+
/**
|
|
24
|
+
* Either a {@link PrintStyle} object, or a raw CSS string (e.g. `'h1 { color: red; }'`)
|
|
25
|
+
* to be injected into the print document's <style> tag as-is.
|
|
26
|
+
*/
|
|
27
|
+
type PrintStyleInput = PrintStyle | string;
|
|
23
28
|
declare class PrintBase {
|
|
24
29
|
private document;
|
|
25
30
|
private nonce;
|
|
@@ -30,17 +35,13 @@ declare class PrintBase {
|
|
|
30
35
|
/**
|
|
31
36
|
* Sets the print styles based on the provided values.
|
|
32
37
|
*
|
|
33
|
-
* @param
|
|
38
|
+
* @param values - Either a key-value pairs object representing print styles, or a raw CSS string.
|
|
34
39
|
* @protected
|
|
35
40
|
*/
|
|
36
|
-
protected setPrintStyle(values:
|
|
41
|
+
protected setPrintStyle(values: PrintStyleInput): void;
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
43
|
* @returns the string that create the stylesheet which will be injected
|
|
41
44
|
* later within <style></style> tag.
|
|
42
|
-
*
|
|
43
|
-
* -join/replace to transform an array objects to css-styled string
|
|
44
45
|
*/
|
|
45
46
|
returnStyleValues(): string;
|
|
46
47
|
/**
|
|
@@ -101,83 +102,46 @@ declare class PrintBase {
|
|
|
101
102
|
private printWithIframe;
|
|
102
103
|
private prepareDocumentComponents;
|
|
103
104
|
private buildPrintDocument;
|
|
104
|
-
static ɵfac:
|
|
105
|
-
static ɵprov:
|
|
105
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PrintBase, never>;
|
|
106
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PrintBase>;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
declare class NgxPrintDirective extends PrintBase {
|
|
109
|
-
private printOptions;
|
|
110
110
|
/**
|
|
111
111
|
* Prevents the print dialog from opening on the window
|
|
112
|
-
*
|
|
113
|
-
* @memberof NgxPrintDirective
|
|
114
112
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* @memberof NgxPrintDirective
|
|
120
|
-
*/
|
|
121
|
-
set printSectionId(value: string);
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* @memberof NgxPrintDirective
|
|
126
|
-
*/
|
|
127
|
-
set printTitle(value: string);
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @memberof NgxPrintDirective
|
|
132
|
-
*/
|
|
133
|
-
set useExistingCss(value: boolean);
|
|
113
|
+
readonly previewOnly: _angular_core.InputSignal<boolean>;
|
|
114
|
+
readonly printSectionId: _angular_core.InputSignal<string>;
|
|
115
|
+
readonly printTitle: _angular_core.InputSignal<string>;
|
|
116
|
+
readonly useExistingCss: _angular_core.InputSignal<boolean>;
|
|
134
117
|
/**
|
|
135
118
|
* A delay in milliseconds to force the print dialog to wait before opened. Default: 0
|
|
136
|
-
*
|
|
137
|
-
* @memberof NgxPrintDirective
|
|
138
119
|
*/
|
|
139
|
-
|
|
120
|
+
readonly printDelay: _angular_core.InputSignal<number>;
|
|
140
121
|
/**
|
|
141
122
|
* Whether to close the window after print() returns.
|
|
142
|
-
*
|
|
143
123
|
*/
|
|
144
|
-
|
|
124
|
+
readonly closeWindow: _angular_core.InputSignal<boolean>;
|
|
145
125
|
/**
|
|
146
126
|
* Class attribute to apply to the body element.
|
|
147
|
-
*
|
|
148
127
|
*/
|
|
149
|
-
|
|
128
|
+
readonly bodyClass: _angular_core.InputSignal<string>;
|
|
150
129
|
/**
|
|
151
130
|
* Which PrintMethod (iframe/window/tab) to use.
|
|
152
|
-
*
|
|
153
|
-
*/
|
|
154
|
-
set printMethod(value: typeof PrintOptions.prototype.printMethod);
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* @memberof NgxPrintDirective
|
|
159
|
-
*/
|
|
160
|
-
set printStyle(values: PrintStyle);
|
|
161
|
-
/**
|
|
162
|
-
* @memberof NgxPrintDirective
|
|
163
|
-
* @param cssList
|
|
164
|
-
*/
|
|
165
|
-
set styleSheetFile(cssList: string);
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* @memberof NgxPrintDirective
|
|
170
131
|
*/
|
|
132
|
+
readonly printMethod: _angular_core.InputSignal<"window" | "tab" | "iframe">;
|
|
133
|
+
readonly printStyle: _angular_core.InputSignal<PrintStyleInput>;
|
|
134
|
+
readonly styleSheetFile: _angular_core.InputSignal<string>;
|
|
135
|
+
readonly printCompleted: _angular_core.OutputEmitterRef<void>;
|
|
171
136
|
print(): void;
|
|
172
|
-
|
|
173
|
-
static
|
|
174
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPrintDirective, "[ngxPrint]", never, { "previewOnly": { "alias": "previewOnly"; "required": false; }; "printSectionId": { "alias": "printSectionId"; "required": false; }; "printTitle": { "alias": "printTitle"; "required": false; }; "useExistingCss": { "alias": "useExistingCss"; "required": false; }; "printDelay": { "alias": "printDelay"; "required": false; }; "closeWindow": { "alias": "closeWindow"; "required": false; }; "bodyClass": { "alias": "bodyClass"; "required": false; }; "printMethod": { "alias": "printMethod"; "required": false; }; "printStyle": { "alias": "printStyle"; "required": false; }; "styleSheetFile": { "alias": "styleSheetFile"; "required": false; }; }, { "printCompleted": "printCompleted"; }, never, never, true, never>;
|
|
137
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxPrintDirective, never>;
|
|
138
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxPrintDirective, "[ngxPrint]", never, { "previewOnly": { "alias": "previewOnly"; "required": false; "isSignal": true; }; "printSectionId": { "alias": "printSectionId"; "required": false; "isSignal": true; }; "printTitle": { "alias": "printTitle"; "required": false; "isSignal": true; }; "useExistingCss": { "alias": "useExistingCss"; "required": false; "isSignal": true; }; "printDelay": { "alias": "printDelay"; "required": false; "isSignal": true; }; "closeWindow": { "alias": "closeWindow"; "required": false; "isSignal": true; }; "bodyClass": { "alias": "bodyClass"; "required": false; "isSignal": true; }; "printMethod": { "alias": "printMethod"; "required": false; "isSignal": true; }; "printStyle": { "alias": "printStyle"; "required": false; "isSignal": true; }; "styleSheetFile": { "alias": "styleSheetFile"; "required": false; "isSignal": true; }; }, { "printCompleted": "printCompleted"; }, never, never, true, never>;
|
|
175
139
|
}
|
|
176
140
|
|
|
177
141
|
declare class NgxPrintModule {
|
|
178
|
-
static ɵfac:
|
|
179
|
-
static ɵmod:
|
|
180
|
-
static ɵinj:
|
|
142
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxPrintModule, never>;
|
|
143
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<NgxPrintModule, never, [typeof NgxPrintDirective], [typeof NgxPrintDirective]>;
|
|
144
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<NgxPrintModule>;
|
|
181
145
|
}
|
|
182
146
|
|
|
183
147
|
/**
|
|
@@ -201,11 +165,11 @@ declare class NgxPrintService extends PrintBase {
|
|
|
201
165
|
/**
|
|
202
166
|
* Sets the print style for the printing process.
|
|
203
167
|
*
|
|
204
|
-
* @param
|
|
168
|
+
* @param values - Either a dictionary representing the print styles, or a raw CSS string.
|
|
205
169
|
* @memberof NgxPrintService
|
|
206
170
|
* @setter
|
|
207
171
|
*/
|
|
208
|
-
set printStyle(values:
|
|
172
|
+
set printStyle(values: PrintStyleInput);
|
|
209
173
|
/**
|
|
210
174
|
* Sets the stylesheet file for the printing process.
|
|
211
175
|
*
|
|
@@ -214,9 +178,10 @@ declare class NgxPrintService extends PrintBase {
|
|
|
214
178
|
* @setter
|
|
215
179
|
*/
|
|
216
180
|
set styleSheetFile(cssList: string);
|
|
217
|
-
static ɵfac:
|
|
218
|
-
static ɵprov:
|
|
181
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxPrintService, never>;
|
|
182
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxPrintService>;
|
|
219
183
|
}
|
|
220
184
|
|
|
221
185
|
export { NgxPrintDirective, NgxPrintModule, NgxPrintService, PrintOptions };
|
|
186
|
+
export type { PrintStyle, PrintStyleInput };
|
|
222
187
|
//# sourceMappingURL=ngx-print.d.ts.map
|
package/types/ngx-print.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-print.d.ts","sources":["../../../src/lib/print-options.ts","../../../src/lib/ngx-print.base.ts","../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/lib/ngx-print.service.ts"],"mappings":";;;;AAAA,cAAa,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEY,0BAAU,OAAO,CAAC,YAAY;AAK3C;;ACXD;;;;AAIO;AACD,KAAM,UAAU,GAAG,MAAM,SAAS,MAAM;AAE9C,
|
|
1
|
+
{"version":3,"file":"ngx-print.d.ts","sources":["../../../src/lib/print-options.ts","../../../src/lib/ngx-print.base.ts","../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/lib/ngx-print.service.ts"],"mappings":";;;;AAAA,cAAa,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEY,0BAAU,OAAO,C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