ngx-print 20.1.0 → 21.1.0
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 +75 -106
- package/fesm2022/ngx-print.mjs +134 -76
- package/fesm2022/ngx-print.mjs.map +1 -1
- package/package.json +3 -3
- package/{index.d.ts → types/ngx-print.d.ts} +10 -5
- package/types/ngx-print.d.ts.map +1 -0
- package/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -4,51 +4,53 @@
|
|
|
4
4
|
This directive makes printing your HTML sections smooth and easy in your Angular application. It is inspired from the old [AngularJS ngPrint](https://github.com/gilf/ngPrint) directive, thus it is intendend to be used with the new Angular -2/4/5/6/7-... ***Enjoy ! contributions are so welcomed :)***
|
|
5
5
|
|
|
6
6
|
## Dependencies
|
|
7
|
-
|
|
8
|
-
|
|
|
9
|
-
|
|
10
|
-
| 1.
|
|
11
|
-
| 1.
|
|
12
|
-
| 1.
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
7
|
+
|
|
8
|
+
| ngx-print | Angular |
|
|
9
|
+
|-----------|----------------|
|
|
10
|
+
| 1.2.1 | 7.0.0 - 14.1.0 |
|
|
11
|
+
| 1.3.x | 15.0.0 |
|
|
12
|
+
| 1.4.x | 16.0.0 |
|
|
13
|
+
| 1.5.x | 17.0.0 |
|
|
14
|
+
| 2.x.x | 18.0.0 |
|
|
15
|
+
| 3.x.x | 19.0.0 |
|
|
16
|
+
| 20.x.x | 20.0.0 |
|
|
17
|
+
| 21.x.x | 21.0.0 |
|
|
16
18
|
|
|
17
19
|
## Version Alignment Notice
|
|
18
|
-
Starting with version 20.0.0, this package aligns its major version with the Angular framework version for better clarity and compatibility tracking. Version 20 is intended for Angular 20 and so on.
|
|
19
20
|
|
|
21
|
+
Starting with version 20.0.0, this package aligns its major version with the Angular framework version for better
|
|
22
|
+
clarity and compatibility tracking. Version 20 is intended for Angular 20 and so on.
|
|
20
23
|
|
|
21
24
|
## Setup
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
**1-** In your root application folder run:
|
|
27
|
+
|
|
24
28
|
```bash
|
|
25
29
|
$ npm install ngx-print
|
|
26
30
|
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
**2-** Once `ngx-print` is installed, you need to import the directive `NgxPrintDirective`:
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
import {
|
|
34
|
+
```ts
|
|
35
|
+
import { NgxPrintDirective } from 'ngx-print';
|
|
32
36
|
|
|
33
|
-
@
|
|
37
|
+
@Component({
|
|
34
38
|
...
|
|
35
|
-
imports: [
|
|
39
|
+
imports: [NgxPrintDirective]
|
|
36
40
|
...
|
|
37
41
|
})
|
|
38
|
-
export class
|
|
39
|
-
}
|
|
42
|
+
export class PrintExampleComponent {}
|
|
40
43
|
```
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
**3-** Then plug n' play with it:
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
- Assuming you want to print the following HTML section:
|
|
45
48
|
|
|
46
49
|
```html
|
|
47
50
|
<div>
|
|
48
51
|
<!--Your html stuff that you want to print-->
|
|
49
52
|
</div>
|
|
50
53
|
<button>print</button> <!--Your relevant print button-->
|
|
51
|
-
|
|
52
54
|
```
|
|
53
55
|
|
|
54
56
|
- Now, what you have to do is tagging your *wanted-to-print* section by an `id` attribute, then link that `id` to a directive parameter in your button :
|
|
@@ -68,43 +70,33 @@ export class YourAppModule {
|
|
|
68
70
|
<button printSectionId="print-section" ngxPrint>print</button>
|
|
69
71
|
|
|
70
72
|
```
|
|
73
|
+
|
|
71
74
|
## Optional properties
|
|
72
75
|
|
|
73
76
|
- You want a customized title for your printing window ? you have the choice by adding a new attribute to your print button `printTitle`:
|
|
74
77
|
|
|
75
78
|
|
|
76
79
|
```html
|
|
77
|
-
|
|
78
80
|
<div id="print-section">
|
|
79
|
-
|
|
80
|
-
<!-- ... -->
|
|
81
|
-
|
|
81
|
+
<!-- ... -->
|
|
82
82
|
</div>
|
|
83
83
|
|
|
84
|
-
<button
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
ngxPrint>print</button>
|
|
88
|
-
|
|
84
|
+
<button printTitle="MyTitle"
|
|
85
|
+
printSectionId="print-section"
|
|
86
|
+
ngxPrint>print</button>
|
|
89
87
|
```
|
|
90
88
|
|
|
91
89
|
|
|
92
90
|
- Also, would you like to customize the printing window style sheet (CSS) ? Hence you can do so by adding infinite styles to another attribute called `printStyle`:
|
|
93
|
-
|
|
94
91
|
|
|
95
92
|
```html
|
|
96
|
-
|
|
97
93
|
<div id="print-section">
|
|
98
|
-
|
|
99
|
-
<!-- ... -->
|
|
100
|
-
|
|
94
|
+
<!-- ... -->
|
|
101
95
|
</div>
|
|
102
96
|
|
|
103
|
-
<button
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ngxPrint>print</button>
|
|
107
|
-
|
|
97
|
+
<button [printStyle]="{h1 : {'color': 'red'}, h2 : {'border': 'solid 1px'}}"
|
|
98
|
+
printSectionId="print-section"
|
|
99
|
+
ngxPrint>print</button>
|
|
108
100
|
```
|
|
109
101
|
|
|
110
102
|
Here some simple styles were added to every `h1` & `h2` tags within the `div` where `print-section` is tagged to its `id` attribute.
|
|
@@ -112,53 +104,37 @@ Here some simple styles were added to every `h1` & `h2` tags within the `div` wh
|
|
|
112
104
|
- If you would like to use your existing CSS with media print you can add the `useExistingCss` attribute:
|
|
113
105
|
|
|
114
106
|
```html
|
|
115
|
-
|
|
116
107
|
<div id="print-section">
|
|
117
|
-
|
|
118
|
-
<!-- ... -->
|
|
119
|
-
|
|
108
|
+
<!-- ... -->
|
|
120
109
|
</div>
|
|
121
110
|
|
|
122
|
-
<button
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
ngxPrint>print</button>
|
|
126
|
-
|
|
111
|
+
<button [useExistingCss]="true"
|
|
112
|
+
printSectionId="print-section"
|
|
113
|
+
ngxPrint>print</button>
|
|
127
114
|
```
|
|
128
115
|
|
|
129
116
|
- If you want to customize the printing window style sheet (CSS) by importing the css provided in assets/css use `styleSheetFile`:
|
|
130
117
|
|
|
131
|
-
|
|
132
118
|
```html
|
|
133
|
-
|
|
134
119
|
<div id="print-section">
|
|
135
|
-
|
|
136
|
-
<!-- ... -->
|
|
137
|
-
|
|
120
|
+
<!-- ... -->
|
|
138
121
|
</div>
|
|
139
122
|
|
|
140
|
-
<button
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
```
|
|
123
|
+
<button styleSheetFile="assets/css/custom1.css,assets/css/custom2.css"
|
|
124
|
+
printSectionId="print-section"
|
|
125
|
+
ngxPrint>print</button>
|
|
126
|
+
```
|
|
146
127
|
|
|
147
|
-
- If you would like to show a preview without a print dialog use
|
|
148
|
-
`previewOnly`:
|
|
128
|
+
- If you would like to show a preview without a print dialog use `previewOnly`:
|
|
149
129
|
|
|
150
130
|
```html
|
|
151
|
-
|
|
152
131
|
<div id="print-section">
|
|
153
|
-
|
|
154
|
-
<!-- ... -->
|
|
155
|
-
|
|
132
|
+
<!-- ... -->
|
|
156
133
|
</div>
|
|
157
134
|
|
|
158
|
-
<button
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
ngxPrint>print</button>
|
|
135
|
+
<button [previewOnly]="true"
|
|
136
|
+
printSectionId="print-section"
|
|
137
|
+
ngxPrint>print</button>
|
|
162
138
|
|
|
163
139
|
```
|
|
164
140
|
|
|
@@ -167,69 +143,60 @@ Here some simple styles were added to every `h1` & `h2` tags within the `div` wh
|
|
|
167
143
|
```html
|
|
168
144
|
|
|
169
145
|
<div id="print-section">
|
|
170
|
-
|
|
171
|
-
<!-- ... -->
|
|
172
|
-
|
|
146
|
+
<!-- ... -->
|
|
173
147
|
</div>
|
|
174
148
|
|
|
175
|
-
<button
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
ngxPrint>print</button>
|
|
149
|
+
<button [closeWindow]="false"
|
|
150
|
+
printSectionId="print-section"
|
|
151
|
+
ngxPrint>print</button>
|
|
179
152
|
|
|
180
153
|
```
|
|
181
154
|
|
|
182
155
|
- Set `bodyClass` to whatever class values are needed for some of your css rules that expect an ancestor to have a certain class. For example, a theme selector:
|
|
183
156
|
|
|
184
157
|
```html
|
|
185
|
-
|
|
186
158
|
<div id="print-section">
|
|
187
|
-
|
|
188
159
|
<!-- ... -->
|
|
189
|
-
|
|
190
160
|
</div>
|
|
191
161
|
|
|
192
|
-
<button
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
ngxPrint>print</button>
|
|
196
|
-
|
|
162
|
+
<button [bodyClass]="theme-dark"
|
|
163
|
+
printSectionId="print-section"
|
|
164
|
+
ngxPrint>print</button>
|
|
197
165
|
```
|
|
198
166
|
|
|
199
167
|
- To print in a new tab rather than a new window set the property `openNewTab` to true. By default `openNewTab` is false and ngxPrint will open a new print window.
|
|
200
168
|
|
|
201
169
|
```html
|
|
202
|
-
<button
|
|
203
|
-
|
|
204
|
-
ngxPrint>print</button>
|
|
170
|
+
<button [openNewTab]="true"
|
|
171
|
+
ngxPrint>print</button>
|
|
205
172
|
```
|
|
206
173
|
|
|
207
174
|
- To run a function after printing completes, subscribe to the `printCompleted` event. Please note it is impossible to differentiate between the Cancel or Print buttong being clicked on the print window. This event will fire regardless of which button was clicked:
|
|
208
175
|
|
|
209
176
|
```html
|
|
210
|
-
<button
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
ngxPrint>
|
|
214
|
-
print
|
|
177
|
+
<button (printCompleted)="onPrintComplete()"
|
|
178
|
+
printSectionId="print-section"
|
|
179
|
+
ngxPrint>print
|
|
215
180
|
</button>
|
|
216
181
|
```
|
|
217
182
|
|
|
218
183
|
## Using NgxPrint as a service (v1.5+)
|
|
219
|
-
Inject the NgxPrintService in the constructor of your component or service:
|
|
220
184
|
|
|
221
|
-
|
|
222
|
-
|
|
185
|
+
Inject the NgxPrintService into your component or service:
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
private readonly printService = inject(NgxPrintService);
|
|
223
189
|
```
|
|
224
190
|
|
|
225
191
|
### Printing a Section
|
|
192
|
+
|
|
226
193
|
```typescript
|
|
227
194
|
import { PrintOptions } from './path-to-your/print-options.model';
|
|
228
195
|
|
|
229
|
-
printMe() {
|
|
196
|
+
printMe(): void {
|
|
230
197
|
const customPrintOptions: PrintOptions = new PrintOptions({
|
|
231
198
|
printSectionId: 'print-section',
|
|
232
|
-
//
|
|
199
|
+
// add any other print options as needed
|
|
233
200
|
});
|
|
234
201
|
this.printService.print(customPrintOptions)
|
|
235
202
|
}
|
|
@@ -239,16 +206,17 @@ printMe() {
|
|
|
239
206
|
The print options object allows you to specify how the print job should be handled. All of which have default values that you can optionally override, although printSectionId is required. It contains the following properties:
|
|
240
207
|
```typescript
|
|
241
208
|
printSectionId: string = null;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
209
|
+
printTitle: string = null;
|
|
210
|
+
useExistingCss: boolean = false;
|
|
211
|
+
bodyClass: string = '';
|
|
212
|
+
openNewTab: boolean = false;
|
|
213
|
+
previewOnly: boolean = false;
|
|
214
|
+
closeWindow: boolean = true;
|
|
215
|
+
printDelay: number = 0;
|
|
249
216
|
```
|
|
250
217
|
|
|
251
218
|
### Setting PrintStyles or StyleSheets
|
|
219
|
+
|
|
252
220
|
```typescript
|
|
253
221
|
// Optional property for css as a key-value pair
|
|
254
222
|
this.printService.printStyle = styleSheet;
|
|
@@ -258,6 +226,7 @@ this.printService.styleSheetFile = fileLocation;
|
|
|
258
226
|
```
|
|
259
227
|
|
|
260
228
|
### Subscribing to print event
|
|
229
|
+
|
|
261
230
|
```typescript
|
|
262
231
|
this.printService.printComplete$.pipe(take(1)).subscribe(() => {
|
|
263
232
|
console.log('Print completed!');
|
|
@@ -267,7 +236,7 @@ this.printService.styleSheetFile = fileLocation;
|
|
|
267
236
|
## Content-Security-Policy (CSP) Support
|
|
268
237
|
If Angular is configured to use a [CSP Nonce](https://angular.io/api/core/CSP_NONCE), ngx-print will automatically inject the `[printStyle]` CSS rules with this Nonce authorization.
|
|
269
238
|
|
|
270
|
-
## Contributors :1st_place_medal:
|
|
239
|
+
## Contributors :1st_place_medal:
|
|
271
240
|
|
|
272
241
|
Huge thanks to: [deeplotia](https://github.com/deeplotia) , [Ben L](https://github.com/broem) , [Gavyn McKenzie](https://github.com/gavmck) , [silenceway](https://github.com/silenceway), [Muhammad Ahsan Ayaz](https://github.com/AhsanAyaz), [Core121](https://github.com/Core121) and to all `ngx-print` users
|
|
273
242
|
|
package/fesm2022/ngx-print.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { Subject, take } from 'rxjs';
|
|
|
4
4
|
|
|
5
5
|
class PrintBase {
|
|
6
6
|
nonce = inject(CSP_NONCE, { optional: true });
|
|
7
|
+
_iframeElement;
|
|
7
8
|
_printStyle = [];
|
|
8
9
|
_styleSheetFile = '';
|
|
9
10
|
printComplete = new Subject();
|
|
@@ -16,10 +17,8 @@ class PrintBase {
|
|
|
16
17
|
*/
|
|
17
18
|
setPrintStyle(values) {
|
|
18
19
|
this._printStyle = [];
|
|
19
|
-
for (const key
|
|
20
|
-
|
|
21
|
-
this._printStyle.push((key + JSON.stringify(values[key])).replace(/['"]+/g, ''));
|
|
22
|
-
}
|
|
20
|
+
for (const key of Object.keys(values)) {
|
|
21
|
+
this._printStyle.push((key + JSON.stringify(values[key])).replace(/['"]+/g, ''));
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
@@ -49,7 +48,7 @@ class PrintBase {
|
|
|
49
48
|
* @protected
|
|
50
49
|
*/
|
|
51
50
|
setStyleSheetFile(cssList) {
|
|
52
|
-
const linkTagFn =
|
|
51
|
+
const linkTagFn = (cssFileName) => {
|
|
53
52
|
return `<link rel="stylesheet" type="text/css" href="${cssFileName}">`;
|
|
54
53
|
};
|
|
55
54
|
if (cssList.indexOf(',') !== -1) {
|
|
@@ -69,8 +68,7 @@ class PrintBase {
|
|
|
69
68
|
* @private
|
|
70
69
|
*/
|
|
71
70
|
updateInputDefaults(elements) {
|
|
72
|
-
for (
|
|
73
|
-
const element = elements[i];
|
|
71
|
+
for (const element of Array.from(elements)) {
|
|
74
72
|
element['defaultValue'] = element.value;
|
|
75
73
|
if (element['checked'])
|
|
76
74
|
element['defaultChecked'] = true;
|
|
@@ -83,9 +81,10 @@ class PrintBase {
|
|
|
83
81
|
* @private
|
|
84
82
|
*/
|
|
85
83
|
updateSelectDefaults(elements) {
|
|
86
|
-
for (
|
|
87
|
-
const element = elements[i];
|
|
84
|
+
for (const element of Array.from(elements)) {
|
|
88
85
|
const selectedIdx = element.selectedIndex;
|
|
86
|
+
if (selectedIdx < 0 || selectedIdx >= element.options.length)
|
|
87
|
+
continue;
|
|
89
88
|
const selectedOption = element.options[selectedIdx];
|
|
90
89
|
selectedOption.defaultSelected = true;
|
|
91
90
|
}
|
|
@@ -97,8 +96,7 @@ class PrintBase {
|
|
|
97
96
|
* @private
|
|
98
97
|
*/
|
|
99
98
|
updateTextAreaDefaults(elements) {
|
|
100
|
-
for (
|
|
101
|
-
const element = elements[i];
|
|
99
|
+
for (const element of Array.from(elements)) {
|
|
102
100
|
element['defaultValue'] = element.value;
|
|
103
101
|
}
|
|
104
102
|
}
|
|
@@ -120,10 +118,10 @@ class PrintBase {
|
|
|
120
118
|
* @private
|
|
121
119
|
*/
|
|
122
120
|
updateCanvasToImage(elements) {
|
|
123
|
-
for (
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
for (const canvasElement of Array.from(elements)) {
|
|
122
|
+
const imgHtml = this.canvasToImageHtml(canvasElement);
|
|
123
|
+
canvasElement.insertAdjacentHTML('afterend', imgHtml);
|
|
124
|
+
canvasElement.remove();
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
/**
|
|
@@ -173,23 +171,17 @@ class PrintBase {
|
|
|
173
171
|
* @public
|
|
174
172
|
*/
|
|
175
173
|
print(printOptions) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (printOptions.useExistingCss) {
|
|
179
|
-
styles = this.getElementTag('style');
|
|
180
|
-
links = this.getElementTag('link');
|
|
181
|
-
}
|
|
182
|
-
// If the openNewTab option is set to true, then set the popOut option to an empty string.
|
|
183
|
-
// This will cause the print dialog to open in a new tab.
|
|
184
|
-
if (printOptions.openNewTab) {
|
|
185
|
-
popOut = '';
|
|
174
|
+
if (printOptions.printMethod === 'iframe') {
|
|
175
|
+
this.printWithIframe(printOptions);
|
|
186
176
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
// Handle the case where the specified print section is not found.
|
|
190
|
-
console.error(`Print section with id ${printOptions.printSectionId} not found.`);
|
|
191
|
-
return;
|
|
177
|
+
else {
|
|
178
|
+
this.printWithWindow(printOptions);
|
|
192
179
|
}
|
|
180
|
+
}
|
|
181
|
+
printWithWindow(printOptions) {
|
|
182
|
+
// If the openNewTab option is set to true, then set the popOut option to an empty string
|
|
183
|
+
// This will cause the print dialog to open in a new tab.
|
|
184
|
+
const popOut = printOptions.printMethod === 'tab' ? '' : 'top=0,left=0,height=auto,width=auto';
|
|
193
185
|
const popupWin = window.open('', '_blank', popOut);
|
|
194
186
|
if (!popupWin) {
|
|
195
187
|
// the popup window could not be opened.
|
|
@@ -198,33 +190,7 @@ class PrintBase {
|
|
|
198
190
|
}
|
|
199
191
|
popupWin.document.open();
|
|
200
192
|
// Create the HTML structure
|
|
201
|
-
|
|
202
|
-
// Set up the basic HTML structure
|
|
203
|
-
const html = doc.createElement('html');
|
|
204
|
-
const head = doc.createElement('head');
|
|
205
|
-
const body = doc.createElement('body');
|
|
206
|
-
// Set title
|
|
207
|
-
const title = doc.createElement('title');
|
|
208
|
-
title.textContent = printOptions.printTitle || '';
|
|
209
|
-
head.appendChild(title);
|
|
210
|
-
// Add base tag, styles, and links
|
|
211
|
-
if (baseTag) {
|
|
212
|
-
head.innerHTML += baseTag;
|
|
213
|
-
}
|
|
214
|
-
head.innerHTML += this.returnStyleValues();
|
|
215
|
-
head.innerHTML += this.returnStyleSheetLinkTags();
|
|
216
|
-
head.innerHTML += styles;
|
|
217
|
-
head.innerHTML += links;
|
|
218
|
-
// Set body class if provided
|
|
219
|
-
if (printOptions.bodyClass) {
|
|
220
|
-
body.className = printOptions.bodyClass;
|
|
221
|
-
}
|
|
222
|
-
// Insert print contents
|
|
223
|
-
body.innerHTML += printContents;
|
|
224
|
-
// Assemble the document
|
|
225
|
-
html.appendChild(head);
|
|
226
|
-
html.appendChild(body);
|
|
227
|
-
doc.appendChild(html);
|
|
193
|
+
this.buildPrintDocument(popupWin.document, printOptions);
|
|
228
194
|
popupWin.document.close();
|
|
229
195
|
// Listen for the window closing
|
|
230
196
|
const checkClosedInterval = setInterval(() => {
|
|
@@ -243,10 +209,102 @@ class PrintBase {
|
|
|
243
209
|
}
|
|
244
210
|
});
|
|
245
211
|
}
|
|
246
|
-
|
|
247
|
-
|
|
212
|
+
printWithIframe(printOptions) {
|
|
213
|
+
if (this._iframeElement) {
|
|
214
|
+
this._iframeElement.remove();
|
|
215
|
+
}
|
|
216
|
+
this._iframeElement = document.createElement('iframe');
|
|
217
|
+
const iframe = this._iframeElement;
|
|
218
|
+
iframe.id = 'print-iframe-' + new Date().getTime();
|
|
219
|
+
iframe.style.position = 'absolute';
|
|
220
|
+
iframe.style.left = '-9999px';
|
|
221
|
+
iframe.style.top = '-9999px';
|
|
222
|
+
iframe.style.width = '0px';
|
|
223
|
+
iframe.style.height = '0px';
|
|
224
|
+
document.body.appendChild(iframe);
|
|
225
|
+
const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;
|
|
226
|
+
if (!iframeDoc) {
|
|
227
|
+
console.error('Could not access iframe document.');
|
|
228
|
+
document.body.removeChild(iframe);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
iframeDoc.open();
|
|
232
|
+
const success = this.buildPrintDocument(iframeDoc, printOptions);
|
|
233
|
+
if (!success) {
|
|
234
|
+
iframeDoc.close();
|
|
235
|
+
document.body.removeChild(iframe);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
iframeDoc.close();
|
|
239
|
+
iframe.onload = () => {
|
|
240
|
+
const printWindow = iframe.contentWindow;
|
|
241
|
+
if (!printWindow) {
|
|
242
|
+
console.error('Could not access iframe window.');
|
|
243
|
+
document.body.removeChild(iframe);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
setTimeout(() => {
|
|
247
|
+
if (printOptions.previewOnly) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
printWindow.focus();
|
|
251
|
+
printWindow.print();
|
|
252
|
+
const mediaQueryList = printWindow.matchMedia('print');
|
|
253
|
+
const listener = (mql) => {
|
|
254
|
+
if (!mql.matches) {
|
|
255
|
+
this.notifyPrintComplete();
|
|
256
|
+
mediaQueryList.removeEventListener('change', listener);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
mediaQueryList.addEventListener('change', listener);
|
|
260
|
+
}, printOptions.printDelay || 0);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
prepareDocumentComponents(printOptions) {
|
|
264
|
+
let styles = '';
|
|
265
|
+
let links = '';
|
|
266
|
+
const baseTag = this.getElementTag('base');
|
|
267
|
+
if (printOptions.useExistingCss) {
|
|
268
|
+
styles = this.getElementTag('style');
|
|
269
|
+
links = this.getElementTag('link');
|
|
270
|
+
}
|
|
271
|
+
const printContents = this.getHtmlContents(printOptions.printSectionId);
|
|
272
|
+
return { styles, links, baseTag, printContents };
|
|
273
|
+
}
|
|
274
|
+
buildPrintDocument(doc, printOptions) {
|
|
275
|
+
const components = this.prepareDocumentComponents(printOptions);
|
|
276
|
+
if (!components.printContents) {
|
|
277
|
+
console.error(`Print section with id ${printOptions.printSectionId} not found.`);
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
const html = doc.createElement('html');
|
|
281
|
+
const head = doc.createElement('head');
|
|
282
|
+
const body = doc.createElement('body');
|
|
283
|
+
// Set title
|
|
284
|
+
const title = doc.createElement('title');
|
|
285
|
+
title.textContent = printOptions.printTitle || '';
|
|
286
|
+
head.appendChild(title);
|
|
287
|
+
// Add all head content
|
|
288
|
+
if (components.baseTag)
|
|
289
|
+
head.innerHTML += components.baseTag;
|
|
290
|
+
head.innerHTML += this.returnStyleValues();
|
|
291
|
+
head.innerHTML += this.returnStyleSheetLinkTags();
|
|
292
|
+
head.innerHTML += components.styles;
|
|
293
|
+
head.innerHTML += components.links;
|
|
294
|
+
// Set body class and content
|
|
295
|
+
if (printOptions.bodyClass)
|
|
296
|
+
body.className = printOptions.bodyClass;
|
|
297
|
+
body.innerHTML += components.printContents;
|
|
298
|
+
// Assemble document
|
|
299
|
+
html.appendChild(head);
|
|
300
|
+
html.appendChild(body);
|
|
301
|
+
doc.appendChild(html);
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: PrintBase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
305
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: PrintBase, providedIn: 'root' });
|
|
248
306
|
}
|
|
249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: PrintBase, decorators: [{
|
|
250
308
|
type: Injectable,
|
|
251
309
|
args: [{
|
|
252
310
|
providedIn: 'root',
|
|
@@ -258,7 +316,7 @@ class PrintOptions {
|
|
|
258
316
|
printTitle = '';
|
|
259
317
|
useExistingCss = false;
|
|
260
318
|
bodyClass = '';
|
|
261
|
-
|
|
319
|
+
printMethod = 'window';
|
|
262
320
|
previewOnly = false;
|
|
263
321
|
closeWindow = true;
|
|
264
322
|
printDelay = 0;
|
|
@@ -326,11 +384,11 @@ class NgxPrintDirective extends PrintBase {
|
|
|
326
384
|
this.printOptions = { ...this.printOptions, bodyClass: value };
|
|
327
385
|
}
|
|
328
386
|
/**
|
|
329
|
-
*
|
|
387
|
+
* Which PrintMethod (iframe/window/tab) to use.
|
|
330
388
|
*
|
|
331
389
|
*/
|
|
332
|
-
set
|
|
333
|
-
this.printOptions = { ...this.printOptions,
|
|
390
|
+
set printMethod(value) {
|
|
391
|
+
this.printOptions = { ...this.printOptions, printMethod: value };
|
|
334
392
|
}
|
|
335
393
|
/**
|
|
336
394
|
*
|
|
@@ -359,10 +417,10 @@ class NgxPrintDirective extends PrintBase {
|
|
|
359
417
|
});
|
|
360
418
|
}
|
|
361
419
|
printCompleted = output();
|
|
362
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
363
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
420
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
421
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.8", type: NgxPrintDirective, isStandalone: true, selector: "[ngxPrint]", inputs: { previewOnly: "previewOnly", printSectionId: "printSectionId", printTitle: "printTitle", useExistingCss: "useExistingCss", printDelay: "printDelay", closeWindow: "closeWindow", bodyClass: "bodyClass", printMethod: "printMethod", printStyle: "printStyle", styleSheetFile: "styleSheetFile" }, outputs: { printCompleted: "printCompleted" }, host: { listeners: { "click": "print()" } }, usesInheritance: true, ngImport: i0 });
|
|
364
422
|
}
|
|
365
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintDirective, decorators: [{
|
|
366
424
|
type: Directive,
|
|
367
425
|
args: [{
|
|
368
426
|
selector: '[ngxPrint]',
|
|
@@ -382,7 +440,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImpor
|
|
|
382
440
|
type: Input
|
|
383
441
|
}], bodyClass: [{
|
|
384
442
|
type: Input
|
|
385
|
-
}],
|
|
443
|
+
}], printMethod: [{
|
|
386
444
|
type: Input
|
|
387
445
|
}], printStyle: [{
|
|
388
446
|
type: Input
|
|
@@ -391,14 +449,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImpor
|
|
|
391
449
|
}], print: [{
|
|
392
450
|
type: HostListener,
|
|
393
451
|
args: ['click']
|
|
394
|
-
}] } });
|
|
452
|
+
}], printCompleted: [{ type: i0.Output, args: ["printCompleted"] }] } });
|
|
395
453
|
|
|
396
454
|
class NgxPrintModule {
|
|
397
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
398
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
399
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
455
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
456
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintModule, imports: [NgxPrintDirective], exports: [NgxPrintDirective] });
|
|
457
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintModule });
|
|
400
458
|
}
|
|
401
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintModule, decorators: [{
|
|
402
460
|
type: NgModule,
|
|
403
461
|
args: [{
|
|
404
462
|
imports: [NgxPrintDirective],
|
|
@@ -447,10 +505,10 @@ class NgxPrintService extends PrintBase {
|
|
|
447
505
|
set styleSheetFile(cssList) {
|
|
448
506
|
super.setStyleSheetFile(cssList);
|
|
449
507
|
}
|
|
450
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
451
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
508
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
509
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintService, providedIn: 'root' });
|
|
452
510
|
}
|
|
453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: NgxPrintService, decorators: [{
|
|
454
512
|
type: Injectable,
|
|
455
513
|
args: [{
|
|
456
514
|
providedIn: 'root',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-print.mjs","sources":["../../../src/lib/ngx-print.base.ts","../../../src/lib/print-options.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":["import { CSP_NONCE, Injectable, inject } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { PrintOptions } from './print-options';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PrintBase {\r\n private nonce = inject(CSP_NONCE, { optional: true });\r\n\r\n private _printStyle: string[] = [];\r\n private _styleSheetFile: string = '';\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: { [key: string]: { [key: string]: string } }) {\r\n this._printStyle = [];\r\n for (const key in values) {\r\n if (Object.prototype.hasOwnProperty.call(values, key)) {\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 *\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() {\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() {\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 protected setStyleSheetFile(cssList: string) {\r\n const linkTagFn = function (cssFileName: string) {\r\n return `<link rel=\"stylesheet\" type=\"text/css\" href=\"${cssFileName}\">`;\r\n };\r\n\r\n if (cssList.indexOf(',') !== -1) {\r\n const valueArr = cssList.split(',');\r\n this._styleSheetFile = valueArr.map(val => linkTagFn(val)).join('');\r\n } else {\r\n this._styleSheetFile = linkTagFn(cssList);\r\n }\r\n }\r\n\r\n //#endregion\r\n\r\n //#region Private methods used by PrintBase\r\n\r\n /**\r\n * Updates the default values for input elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.\r\n * @private\r\n */\r\n private updateInputDefaults(elements: HTMLCollectionOf<HTMLInputElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n element['defaultValue'] = element.value;\r\n if (element['checked']) element['defaultChecked'] = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for select elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.\r\n * @private\r\n */\r\n private updateSelectDefaults(elements: HTMLCollectionOf<HTMLSelectElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n const selectedIdx = element.selectedIndex;\r\n const selectedOption: HTMLOptionElement = element.options[selectedIdx];\r\n\r\n selectedOption.defaultSelected = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for textarea elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.\r\n * @private\r\n */\r\n private updateTextAreaDefaults(elements: HTMLCollectionOf<HTMLTextAreaElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n element['defaultValue'] = element.value;\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} element - The canvas element to convert.\r\n * @returns {string} - HTML string of the image.\r\n * @private\r\n */\r\n private canvasToImageHtml(element: HTMLCanvasElement): string {\r\n const dataUrl = element.toDataURL();\r\n return `<img src=\"${dataUrl}\" style=\"max-width: 100%;\">`;\r\n }\r\n\r\n /**\r\n * Includes canvas contents in the print section via img tags.\r\n *\r\n * @param {HTMLCollectionOf<HTMLCanvasElement>} elements - Collection of canvas elements.\r\n * @private\r\n */\r\n private updateCanvasToImage(elements: HTMLCollectionOf<HTMLCanvasElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = this.canvasToImageHtml(elements[i]);\r\n elements[i].insertAdjacentHTML('afterend', element);\r\n elements[i].remove();\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 printContents = document.getElementById(printSectionId);\r\n if (!printContents) return null;\r\n\r\n const inputEls = printContents.getElementsByTagName('input');\r\n const selectEls = printContents.getElementsByTagName('select');\r\n const textAreaEls = printContents.getElementsByTagName('textarea');\r\n const canvasEls = printContents.getElementsByTagName('canvas');\r\n\r\n this.updateInputDefaults(inputEls);\r\n this.updateSelectDefaults(selectEls);\r\n this.updateTextAreaDefaults(textAreaEls);\r\n this.updateCanvasToImage(canvasEls);\r\n\r\n return printContents.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 = document.getElementsByTagName(tag);\r\n for (let index = 0; index < elements.length; index++) {\r\n html.push(elements[index].outerHTML);\r\n }\r\n return html.join('\\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 * @param {PrintOptions} printOptions - Options for printing.\r\n * @public\r\n */\r\n protected print(printOptions: PrintOptions): void {\r\n let styles = '',\r\n links = '',\r\n popOut = 'top=0,left=0,height=auto,width=auto';\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 // 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 if (printOptions.openNewTab) {\r\n popOut = '';\r\n }\r\n\r\n const printContents = this.getHtmlContents(printOptions.printSectionId);\r\n if (!printContents) {\r\n // Handle the case where the specified print section is not found.\r\n console.error(`Print section with id ${printOptions.printSectionId} not found.`);\r\n return;\r\n }\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\r\n // Create the HTML structure\r\n const doc = popupWin.document;\r\n\r\n // Set up the basic HTML structure\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 base tag, styles, and links\r\n if (baseTag) {\r\n head.innerHTML += baseTag;\r\n }\r\n head.innerHTML += this.returnStyleValues();\r\n head.innerHTML += this.returnStyleSheetLinkTags();\r\n head.innerHTML += styles;\r\n head.innerHTML += links;\r\n\r\n // Set body class if provided\r\n if (printOptions.bodyClass) {\r\n body.className = printOptions.bodyClass;\r\n }\r\n\r\n // Insert print contents\r\n body.innerHTML += printContents;\r\n\r\n // Assemble the document\r\n html.appendChild(head);\r\n html.appendChild(body);\r\n doc.appendChild(html);\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","export class PrintOptions {\r\n printSectionId: string = '';\r\n printTitle: string = '';\r\n useExistingCss: boolean = false;\r\n bodyClass: string = '';\r\n openNewTab: boolean = false;\r\n previewOnly: boolean = false;\r\n closeWindow: boolean = true;\r\n printDelay: number = 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 { Directive, HostListener, Input, output } from '@angular/core';\r\nimport { PrintBase } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\nimport { take } from 'rxjs';\r\n@Directive({\r\n selector: '[ngxPrint]',\r\n standalone: true,\r\n})\r\nexport class NgxPrintDirective extends PrintBase {\r\n private printOptions = new PrintOptions();\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 * Whether to open a new window or default to new window.\r\n *\r\n */\r\n @Input() set openNewTab(value: boolean) {\r\n this.printOptions = { ...this.printOptions, openNewTab: 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: { [key: string]: { [key: string]: string } }) {\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 @HostListener('click')\r\n public print(): void {\r\n super.print(this.printOptions);\r\n this.printComplete.pipe(take(1)).subscribe(() => {\r\n this.printCompleted.emit(undefined);\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 } 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 * 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 print(printOptions: 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: { [key: string]: { [key: string]: string } }) {\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":";;;;MAOa,SAAS,CAAA;IACZ,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE7C,WAAW,GAAa,EAAE;IAC1B,eAAe,GAAW,EAAE;AAC1B,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG7C;;;;;AAKG;AACO,IAAA,aAAa,CAAC,MAAoD,EAAA;AAC1E,QAAA,IAAI,CAAC,WAAW,GAAG,EAAE;AACrB,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;AACxB,YAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;gBACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClF;QACF;IACF;AAEA;;;;;;;AAOG;IACI,iBAAiB,GAAA;AACtB,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAA,QAAA,EAAW,IAAI,CAAC,KAAK,CAAA,CAAA,CAAG,GAAG,EAAE;AAC7D,QAAA,OAAO,SAAS,UAAU,CAAA,EAAA,EAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,WAAW;IACzF;AAEA;;;;AAIG;IACK,wBAAwB,GAAA;QAC9B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AC5B,OAAO,EAAE,CAAC,iBAAiB,CAAC;AAC7B,iBAAA;;;ACFD;;;;;;;AAOG;AAIG,MAAO,eAAgB,SAAQ,SAAS,CAAA;AAC5C,IAAA,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;AAClD;;;;;;AAMG;AACI,IAAA,KAAK,CAAC,YAA0B,EAAA;;AAErC,QAAA,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC;IAC3B;AAEA;;;;;;AAMG;IACH,IAAI,UAAU,CAAC,MAAoD,EAAA;AACjE,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;uGAlCW,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/ngx-print.base.ts","../../../src/lib/print-options.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":["import { CSP_NONCE, inject, Injectable } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { PrintOptions } from './print-options';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PrintBase {\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: string = '';\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: { [key: string]: { [key: string]: string } }) {\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() {\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() {\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 protected setStyleSheetFile(cssList: string) {\r\n const linkTagFn = (cssFileName: string) => {\r\n return `<link rel=\"stylesheet\" type=\"text/css\" href=\"${cssFileName}\">`;\r\n };\r\n\r\n if (cssList.indexOf(',') !== -1) {\r\n const valueArr = cssList.split(',');\r\n this._styleSheetFile = valueArr.map(val => linkTagFn(val)).join('');\r\n } else {\r\n this._styleSheetFile = linkTagFn(cssList);\r\n }\r\n }\r\n\r\n //#endregion\r\n\r\n //#region Private methods used by PrintBase\r\n\r\n /**\r\n * Updates the default values for input elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.\r\n * @private\r\n */\r\n private updateInputDefaults(elements: HTMLCollectionOf<HTMLInputElement>): void {\r\n for (const element of Array.from(elements)) {\r\n element['defaultValue'] = element.value;\r\n if (element['checked']) element['defaultChecked'] = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for select elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.\r\n * @private\r\n */\r\n private updateSelectDefaults(elements: HTMLCollectionOf<HTMLSelectElement>): void {\r\n for (const element of Array.from(elements)) {\r\n const selectedIdx = element.selectedIndex;\r\n if (selectedIdx < 0 || selectedIdx >= element.options.length) continue;\r\n const selectedOption: HTMLOptionElement = element.options[selectedIdx];\r\n\r\n selectedOption.defaultSelected = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for textarea elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.\r\n * @private\r\n */\r\n private updateTextAreaDefaults(elements: HTMLCollectionOf<HTMLTextAreaElement>): void {\r\n for (const element of Array.from(elements)) {\r\n element['defaultValue'] = element.value;\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} element - The canvas element to convert.\r\n * @returns {string} - HTML string of the image.\r\n * @private\r\n */\r\n private canvasToImageHtml(element: HTMLCanvasElement): string {\r\n const dataUrl = element.toDataURL();\r\n return `<img src=\"${dataUrl}\" style=\"max-width: 100%;\">`;\r\n }\r\n\r\n /**\r\n * Includes canvas contents in the print section via img tags.\r\n *\r\n * @param {HTMLCollectionOf<HTMLCanvasElement>} elements - Collection of canvas elements.\r\n * @private\r\n */\r\n private updateCanvasToImage(elements: HTMLCollectionOf<HTMLCanvasElement>): void {\r\n for (const canvasElement of Array.from(elements)) {\r\n const imgHtml = this.canvasToImageHtml(canvasElement);\r\n canvasElement.insertAdjacentHTML('afterend', imgHtml);\r\n canvasElement.remove();\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 printContents = document.getElementById(printSectionId);\r\n if (!printContents) return null;\r\n\r\n const inputEls = printContents.getElementsByTagName('input');\r\n const selectEls = printContents.getElementsByTagName('select');\r\n const textAreaEls = printContents.getElementsByTagName('textarea');\r\n const canvasEls = printContents.getElementsByTagName('canvas');\r\n\r\n this.updateInputDefaults(inputEls);\r\n this.updateSelectDefaults(selectEls);\r\n this.updateTextAreaDefaults(textAreaEls);\r\n this.updateCanvasToImage(canvasEls);\r\n\r\n return printContents.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 = document.getElementsByTagName(tag);\r\n for (let index = 0; index < elements.length; index++) {\r\n html.push(elements[index].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 * @param {PrintOptions} printOptions - Options for printing.\r\n * @public\r\n */\r\n protected print(printOptions: PrintOptions): void {\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 = 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\r\n 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 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 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 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 | MediaQueryList) => {\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) head.innerHTML += components.baseTag;\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","export class PrintOptions {\r\n printSectionId: string = '';\r\n printTitle: string = '';\r\n useExistingCss: boolean = false;\r\n bodyClass: string = '';\r\n printMethod: 'window' | 'tab' | 'iframe' = 'window';\r\n previewOnly: boolean = false;\r\n closeWindow: boolean = true;\r\n printDelay: number = 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 { Directive, HostListener, Input, output } from '@angular/core';\r\nimport { PrintBase } 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})\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: { [key: string]: { [key: string]: string } }) {\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 @HostListener('click')\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(undefined);\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 } 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: 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: { [key: string]: { [key: string]: string } }) {\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":";;;;MAOa,SAAS,CAAA;IACZ,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE7C,IAAA,cAAc;IACd,WAAW,GAAa,EAAE;IAC1B,eAAe,GAAW,EAAE;AAC1B,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG7C;;;;;AAKG;AACO,IAAA,aAAa,CAAC,MAAoD,EAAA;AAC1E,QAAA,IAAI,CAAC,WAAW,GAAG,EAAE;QACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACrC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClF;IACF;AAEA;;;;;;;AAOG;IACI,iBAAiB,GAAA;AACtB,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAA,QAAA,EAAW,IAAI,CAAC,KAAK,CAAA,CAAA,CAAG,GAAG,EAAE;AAC7D,QAAA,OAAO,SAAS,UAAU,CAAA,EAAA,EAAK,IAAI,CAAC,WAAW,CAAC,IAAI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oD,EAAA;AACjE,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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-print",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.1.0",
|
|
4
4
|
"description": "Plug n' Play Angular (2++) directive to print your stuff",
|
|
5
5
|
"author": "https://github.com/ngx-print/ngx-print/graphs/contributors",
|
|
6
6
|
"repository": {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"rxjs": "^7.4.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "fesm2022/ngx-print.mjs",
|
|
29
|
-
"typings": "
|
|
29
|
+
"typings": "types/ngx-print.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": {
|
|
32
32
|
"default": "./package.json"
|
|
33
33
|
},
|
|
34
34
|
".": {
|
|
35
|
-
"types": "./
|
|
35
|
+
"types": "./types/ngx-print.d.ts",
|
|
36
36
|
"default": "./fesm2022/ngx-print.mjs"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -7,7 +7,7 @@ declare class PrintOptions {
|
|
|
7
7
|
printTitle: string;
|
|
8
8
|
useExistingCss: boolean;
|
|
9
9
|
bodyClass: string;
|
|
10
|
-
|
|
10
|
+
printMethod: 'window' | 'tab' | 'iframe';
|
|
11
11
|
previewOnly: boolean;
|
|
12
12
|
closeWindow: boolean;
|
|
13
13
|
printDelay: number;
|
|
@@ -16,6 +16,7 @@ declare class PrintOptions {
|
|
|
16
16
|
|
|
17
17
|
declare class PrintBase {
|
|
18
18
|
private nonce;
|
|
19
|
+
private _iframeElement;
|
|
19
20
|
private _printStyle;
|
|
20
21
|
private _styleSheetFile;
|
|
21
22
|
protected printComplete: Subject<void>;
|
|
@@ -112,6 +113,10 @@ declare class PrintBase {
|
|
|
112
113
|
* @public
|
|
113
114
|
*/
|
|
114
115
|
protected print(printOptions: PrintOptions): void;
|
|
116
|
+
protected printWithWindow(printOptions: PrintOptions): void;
|
|
117
|
+
private printWithIframe;
|
|
118
|
+
private prepareDocumentComponents;
|
|
119
|
+
private buildPrintDocument;
|
|
115
120
|
static ɵfac: i0.ɵɵFactoryDeclaration<PrintBase, never>;
|
|
116
121
|
static ɵprov: i0.ɵɵInjectableDeclaration<PrintBase>;
|
|
117
122
|
}
|
|
@@ -159,10 +164,10 @@ declare class NgxPrintDirective extends PrintBase {
|
|
|
159
164
|
*/
|
|
160
165
|
set bodyClass(value: string);
|
|
161
166
|
/**
|
|
162
|
-
*
|
|
167
|
+
* Which PrintMethod (iframe/window/tab) to use.
|
|
163
168
|
*
|
|
164
169
|
*/
|
|
165
|
-
set
|
|
170
|
+
set printMethod(value: typeof PrintOptions.prototype.printMethod);
|
|
166
171
|
/**
|
|
167
172
|
*
|
|
168
173
|
*
|
|
@@ -186,7 +191,7 @@ declare class NgxPrintDirective extends PrintBase {
|
|
|
186
191
|
print(): void;
|
|
187
192
|
readonly printCompleted: i0.OutputEmitterRef<void>;
|
|
188
193
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintDirective, never>;
|
|
189
|
-
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; }; "
|
|
194
|
+
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>;
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
declare class NgxPrintModule {
|
|
@@ -238,4 +243,4 @@ declare class NgxPrintService extends PrintBase {
|
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
export { NgxPrintDirective, NgxPrintModule, NgxPrintService, PrintOptions };
|
|
241
|
-
//# sourceMappingURL=
|
|
246
|
+
//# sourceMappingURL=ngx-print.d.ts.map
|
|
@@ -0,0 +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"],"sourcesContent":[null,null,null,null,null],"names":["_angular_core"],"mappings":";;;;AAAA,cAAA,YAAA;;;;;AAKE;;;;AAKY,0BAAA,OAAA,CAAA,YAAA;AAKb;;ACXD,cAAA,SAAA;;;;;;AAYE;;;;;AAKG;AACH;;AAAmD;;AAAyB;AAO5E;;;;;;;AAOG;;AAMH;;;;AAIG;AACH;AAIA;;;;;AAKG;AACH;AAiBA;;;;;AAKG;AACH;AAOA;;;;;AAKG;AACH;AAUA;;;;;AAKG;AACH;AAMA;;;;;;AAMG;AACH;AAKA;;;;;AAKG;AACH;AAQA;;;;;;AAMG;AACH;AAiBA;;;;;;AAMG;AACH;AAWA;AAIA;;;;;AAKG;AACH,kCAAA,YAAA;AAQA,4CAAA,YAAA;AAqCA;AA2DA;AAeA;;;AAmCD;;ACtVD,cAAA,iBAAA,SAAA,SAAA;;AAOE;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;;AAKH;;;;AAIG;;;AAEuC;;;AAI1C;;;AAGG;AACH;AAKA;;;;AAIG;AAEa;6BAOOA,EAAA,CAAA,gBAAA;;;AACxB;;AC/GD,cAAA,cAAA;;;;AAI8B;;ACH9B;;;;;;;AAOG;AACH,cAAA,eAAA,SAAA,SAAA;AAIE,oBAAc,IAAA,CAAA,UAAA;AAEd;;;;;;AAMG;AACa,wBAAA,YAAA;AAKhB;;;;;;AAMG;;;AACuC;;;AAI1C;;;;;;AAMG;AACH;;;AAGD;;;;"}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.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"],"sourcesContent":[null,null,null,null,null],"names":["_angular_core"],"mappings":";;;;AAAA,cAAA,YAAA;;;;;;;;;AAUc,0BAAA,OAAA,CAAA,YAAA;AAKb;;ACXD,cAAA,SAAA;;;;;AAWE;;;;;AAKG;AACH;;AAAmD;;AAAyB;AAS5E;;;;;;;AAOG;;AAMH;;;;AAIG;AACH;AAIA;;;;;AAKG;AACH;AAiBA;;;;;AAKG;AACH;AAQA;;;;;AAKG;AACH;AAUA;;;;;AAKG;AACH;AAOA;;;;;;AAMG;AACH;AAKA;;;;;AAKG;AACH;AAQA;;;;;;AAMG;AACH;AAiBA;;;;;;AAMG;AACH;AAUA;AAIA;;;;;AAKG;AACH,kCAAA,YAAA;;;AAwFD;;ACvRD,cAAA,iBAAA,SAAA,SAAA;;AAME;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;AACH;AAIA;;;;AAIG;;;AAEuC;;;AAI1C;;;AAGG;AACH;AAKA;;;;AAIG;AAEI;6BAOgBA,EAAA,CAAA,gBAAA;;;AACxB;;AC7GD,cAAA,cAAA;;;;AAI8B;;ACH9B;;;;;;;AAOG;AACH,cAAA,eAAA,SAAA,SAAA;AAIE,oBAAc,IAAA,CAAA,UAAA;AACd;;;;;;AAMG;AACI,wBAAA,YAAA;AAKP;;;;;;AAMG;;;AACuC;;;AAI1C;;;;;;AAMG;AACH;;;AAGD;;;;"}
|