ng2-pdfjs-viewer 14.0.0 → 16.0.4
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/{esm2020 → esm2022}/index.mjs +2 -2
- package/{esm2020 → esm2022}/ng2-pdfjs-viewer.mjs +4 -4
- package/esm2022/src/ng2-pdfjs-viewer.component.mjs +413 -0
- package/esm2022/src/ng2-pdfjs-viewer.module.mjs +24 -0
- package/{fesm2015 → fesm2022}/ng2-pdfjs-viewer.mjs +404 -375
- package/fesm2022/ng2-pdfjs-viewer.mjs.map +1 -0
- package/index.d.ts +2 -2
- package/package.json +9 -15
- package/src/ng2-pdfjs-viewer.component.d.ts +56 -53
- package/src/ng2-pdfjs-viewer.module.d.ts +10 -10
- package/README.md +0 -311
- package/esm2020/src/ng2-pdfjs-viewer.component.mjs +0 -383
- package/esm2020/src/ng2-pdfjs-viewer.module.mjs +0 -23
- package/fesm2015/ng2-pdfjs-viewer.mjs.map +0 -1
- package/fesm2020/ng2-pdfjs-viewer.mjs +0 -410
- package/fesm2020/ng2-pdfjs-viewer.mjs.map +0 -1
- package/ng2-pdfjs-viewer.d.ts +0 -5
|
@@ -2,125 +2,147 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { EventEmitter, Component, ViewChild, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
|
|
5
|
-
class PdfJsViewerComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
5
|
+
class PdfJsViewerComponent {
|
|
6
|
+
iframe;
|
|
7
|
+
static lastID = 0;
|
|
8
|
+
viewerId = `ng2-pdfjs-viewer-ID${++PdfJsViewerComponent.lastID}`;
|
|
9
|
+
onBeforePrint = new EventEmitter();
|
|
10
|
+
onAfterPrint = new EventEmitter();
|
|
11
|
+
onDocumentLoad = new EventEmitter();
|
|
12
|
+
onPageChange = new EventEmitter();
|
|
13
|
+
viewerFolder;
|
|
14
|
+
externalWindow = false;
|
|
15
|
+
target = '_blank';
|
|
16
|
+
showSpinner = true;
|
|
17
|
+
downloadFileName;
|
|
18
|
+
openFile = true;
|
|
19
|
+
download = true;
|
|
20
|
+
startDownload;
|
|
21
|
+
viewBookmark = true;
|
|
22
|
+
print = true;
|
|
23
|
+
startPrint;
|
|
24
|
+
fullScreen = true;
|
|
25
|
+
//@Input() public showFullScreen: boolean;
|
|
26
|
+
find = true;
|
|
27
|
+
zoom;
|
|
28
|
+
nameddest;
|
|
29
|
+
pagemode;
|
|
30
|
+
lastPage;
|
|
31
|
+
rotatecw;
|
|
32
|
+
rotateccw;
|
|
33
|
+
cursor;
|
|
34
|
+
scroll;
|
|
35
|
+
spread;
|
|
36
|
+
locale;
|
|
37
|
+
useOnlyCssZoom = false;
|
|
38
|
+
errorOverride = false;
|
|
39
|
+
errorAppend = true;
|
|
40
|
+
errorMessage;
|
|
41
|
+
diagnosticLogs = true;
|
|
42
|
+
externalWindowOptions;
|
|
43
|
+
viewerTab;
|
|
44
|
+
_src;
|
|
45
|
+
_page;
|
|
46
|
+
set page(_page) {
|
|
47
|
+
this._page = _page;
|
|
48
|
+
if (this.PDFViewerApplication) {
|
|
49
|
+
this.PDFViewerApplication.page = this._page;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (this.diagnosticLogs)
|
|
53
|
+
console.warn("Document is not loaded yet!!!. Try to set page# after full load. Ignore this warning if you are not setting page# using '.' notation. (E.g. pdfViewer.page = 5;)");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
get page() {
|
|
57
|
+
if (this.PDFViewerApplication) {
|
|
58
|
+
return this.PDFViewerApplication.page;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (this.diagnosticLogs)
|
|
62
|
+
console.warn("Document is not loaded yet!!!. Try to retrieve page# after full load.");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
set pdfSrc(_src) {
|
|
66
|
+
this._src = _src;
|
|
67
|
+
}
|
|
68
|
+
get pdfSrc() {
|
|
69
|
+
return this._src;
|
|
70
|
+
}
|
|
71
|
+
get PDFViewerApplicationOptions() {
|
|
72
|
+
let pdfViewerOptions = null;
|
|
73
|
+
if (this.externalWindow) {
|
|
74
|
+
if (this.viewerTab) {
|
|
75
|
+
pdfViewerOptions = this.viewerTab.PDFViewerApplicationOptions;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
if (this.iframe.nativeElement.contentWindow) {
|
|
80
|
+
pdfViewerOptions = this.iframe.nativeElement.contentWindow.PDFViewerApplicationOptions;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return pdfViewerOptions;
|
|
84
|
+
}
|
|
85
|
+
get PDFViewerApplication() {
|
|
86
|
+
let pdfViewer = null;
|
|
87
|
+
if (this.externalWindow) {
|
|
88
|
+
if (this.viewerTab) {
|
|
89
|
+
pdfViewer = this.viewerTab.PDFViewerApplication;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (this.iframe.nativeElement.contentWindow) {
|
|
94
|
+
pdfViewer = this.iframe.nativeElement.contentWindow.PDFViewerApplication;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return pdfViewer;
|
|
98
|
+
}
|
|
99
|
+
receiveMessage(viewerEvent) {
|
|
100
|
+
if (viewerEvent.data && viewerEvent.data.viewerId && viewerEvent.data.event) {
|
|
101
|
+
let viewerId = viewerEvent.data.viewerId;
|
|
102
|
+
let event = viewerEvent.data.event;
|
|
103
|
+
let param = viewerEvent.data.param;
|
|
104
|
+
if (this.viewerId == viewerId) {
|
|
105
|
+
if (this.onBeforePrint && event == "beforePrint") {
|
|
106
|
+
this.onBeforePrint.emit();
|
|
107
|
+
}
|
|
108
|
+
else if (this.onAfterPrint && event == "afterPrint") {
|
|
109
|
+
this.onAfterPrint.emit();
|
|
110
|
+
}
|
|
111
|
+
else if (this.onDocumentLoad && event == "pagesLoaded") {
|
|
112
|
+
this.onDocumentLoad.emit(param);
|
|
113
|
+
}
|
|
114
|
+
else if (this.onPageChange && event == "pageChange") {
|
|
115
|
+
this.onPageChange.emit(param);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
ngOnInit() {
|
|
121
|
+
window.addEventListener("message", this.receiveMessage.bind(this), false);
|
|
122
|
+
if (!this.externalWindow) { // Load pdf for embedded views
|
|
123
|
+
this.loadPdf();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
refresh() {
|
|
127
|
+
this.loadPdf();
|
|
128
|
+
}
|
|
129
|
+
relaseUrl; // Avoid memory leask with `URL.createObjectURL`
|
|
130
|
+
loadPdf() {
|
|
131
|
+
if (!this._src) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// console.log(`Tab is - ${this.viewerTab}`);
|
|
135
|
+
// if (this.viewerTab) {
|
|
136
|
+
// console.log(`Status of window - ${this.viewerTab.closed}`);
|
|
137
|
+
// }
|
|
138
|
+
if (this.externalWindow && (typeof this.viewerTab === 'undefined' || this.viewerTab.closed)) {
|
|
139
|
+
this.viewerTab = window.open('', this.target, this.externalWindowOptions || '');
|
|
140
|
+
if (this.viewerTab == null) {
|
|
141
|
+
if (this.diagnosticLogs)
|
|
142
|
+
console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled.");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (this.showSpinner) {
|
|
124
146
|
this.viewerTab.document.write(`
|
|
125
147
|
<style>
|
|
126
148
|
.loader {
|
|
@@ -144,266 +166,273 @@ class PdfJsViewerComponent {
|
|
|
144
166
|
}
|
|
145
167
|
</style>
|
|
146
168
|
<div class="loader"></div>
|
|
147
|
-
`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (this.
|
|
247
|
-
viewerUrl += `&
|
|
248
|
-
}
|
|
249
|
-
if (this.zoom)
|
|
250
|
-
viewerUrl +=
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
type:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
169
|
+
`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this.relaseUrl?.();
|
|
173
|
+
let fileUrl;
|
|
174
|
+
//if (typeof this.src === "string") {
|
|
175
|
+
// fileUrl = this.src;
|
|
176
|
+
//}
|
|
177
|
+
if (this._src instanceof Blob) {
|
|
178
|
+
const url = URL.createObjectURL(this._src);
|
|
179
|
+
fileUrl = encodeURIComponent(url);
|
|
180
|
+
this.relaseUrl = () => URL.revokeObjectURL(url);
|
|
181
|
+
}
|
|
182
|
+
else if (this._src instanceof Uint8Array) {
|
|
183
|
+
let blob = new Blob([this._src], { type: "application/pdf" });
|
|
184
|
+
const url = URL.createObjectURL(blob);
|
|
185
|
+
this.relaseUrl = () => URL.revokeObjectURL(url);
|
|
186
|
+
fileUrl = encodeURIComponent(url);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
fileUrl = this._src;
|
|
190
|
+
}
|
|
191
|
+
let viewerUrl;
|
|
192
|
+
if (this.viewerFolder) {
|
|
193
|
+
viewerUrl = `${this.viewerFolder}/web/viewer.html`;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
viewerUrl = `assets/pdfjs/web/viewer.html`;
|
|
197
|
+
}
|
|
198
|
+
viewerUrl += `?file=${fileUrl}`;
|
|
199
|
+
if (typeof this.viewerId !== 'undefined') {
|
|
200
|
+
viewerUrl += `&viewerId=${this.viewerId}`;
|
|
201
|
+
}
|
|
202
|
+
if (typeof this.onBeforePrint !== 'undefined') {
|
|
203
|
+
viewerUrl += `&beforePrint=true`;
|
|
204
|
+
}
|
|
205
|
+
if (typeof this.onAfterPrint !== 'undefined') {
|
|
206
|
+
viewerUrl += `&afterPrint=true`;
|
|
207
|
+
}
|
|
208
|
+
if (typeof this.onDocumentLoad !== 'undefined') {
|
|
209
|
+
viewerUrl += `&pagesLoaded=true`;
|
|
210
|
+
}
|
|
211
|
+
if (typeof this.onPageChange !== 'undefined') {
|
|
212
|
+
viewerUrl += `&pageChange=true`;
|
|
213
|
+
}
|
|
214
|
+
if (this.downloadFileName) {
|
|
215
|
+
if (!this.downloadFileName.endsWith(".pdf")) {
|
|
216
|
+
this.downloadFileName += ".pdf";
|
|
217
|
+
}
|
|
218
|
+
viewerUrl += `&fileName=${this.downloadFileName}`;
|
|
219
|
+
}
|
|
220
|
+
if (typeof this.openFile !== 'undefined') {
|
|
221
|
+
viewerUrl += `&openFile=${this.openFile}`;
|
|
222
|
+
}
|
|
223
|
+
if (typeof this.download !== 'undefined') {
|
|
224
|
+
viewerUrl += `&download=${this.download}`;
|
|
225
|
+
}
|
|
226
|
+
if (this.startDownload) {
|
|
227
|
+
viewerUrl += `&startDownload=${this.startDownload}`;
|
|
228
|
+
}
|
|
229
|
+
if (typeof this.viewBookmark !== 'undefined') {
|
|
230
|
+
viewerUrl += `&viewBookmark=${this.viewBookmark}`;
|
|
231
|
+
}
|
|
232
|
+
if (typeof this.print !== 'undefined') {
|
|
233
|
+
viewerUrl += `&print=${this.print}`;
|
|
234
|
+
}
|
|
235
|
+
if (this.startPrint) {
|
|
236
|
+
viewerUrl += `&startPrint=${this.startPrint}`;
|
|
237
|
+
}
|
|
238
|
+
if (typeof this.fullScreen !== 'undefined') {
|
|
239
|
+
viewerUrl += `&fullScreen=${this.fullScreen}`;
|
|
240
|
+
}
|
|
241
|
+
// if (this.showFullScreen) {
|
|
242
|
+
// viewerUrl += `&showFullScreen=${this.showFullScreen}`;
|
|
243
|
+
// }
|
|
244
|
+
if (typeof this.find !== 'undefined') {
|
|
245
|
+
viewerUrl += `&find=${this.find}`;
|
|
246
|
+
}
|
|
247
|
+
if (this.lastPage) {
|
|
248
|
+
viewerUrl += `&lastpage=${this.lastPage}`;
|
|
249
|
+
}
|
|
250
|
+
if (this.rotatecw) {
|
|
251
|
+
viewerUrl += `&rotatecw=${this.rotatecw}`;
|
|
252
|
+
}
|
|
253
|
+
if (this.rotateccw) {
|
|
254
|
+
viewerUrl += `&rotateccw=${this.rotateccw}`;
|
|
255
|
+
}
|
|
256
|
+
if (this.cursor) {
|
|
257
|
+
viewerUrl += `&cursor=${this.cursor}`;
|
|
258
|
+
}
|
|
259
|
+
if (this.scroll) {
|
|
260
|
+
viewerUrl += `&scroll=${this.scroll}`;
|
|
261
|
+
}
|
|
262
|
+
if (this.spread) {
|
|
263
|
+
viewerUrl += `&spread=${this.spread}`;
|
|
264
|
+
}
|
|
265
|
+
if (this.locale) {
|
|
266
|
+
viewerUrl += `&locale=${this.locale}`;
|
|
267
|
+
}
|
|
268
|
+
if (this.useOnlyCssZoom) {
|
|
269
|
+
viewerUrl += `&useOnlyCssZoom=${this.useOnlyCssZoom}`;
|
|
270
|
+
}
|
|
271
|
+
if (this._page || this.zoom || this.nameddest || this.pagemode)
|
|
272
|
+
viewerUrl += "#";
|
|
273
|
+
if (this._page) {
|
|
274
|
+
viewerUrl += `&page=${this._page}`;
|
|
275
|
+
}
|
|
276
|
+
if (this.zoom) {
|
|
277
|
+
viewerUrl += `&zoom=${this.zoom}`;
|
|
278
|
+
}
|
|
279
|
+
if (this.nameddest) {
|
|
280
|
+
viewerUrl += `&nameddest=${this.nameddest}`;
|
|
281
|
+
}
|
|
282
|
+
if (this.pagemode) {
|
|
283
|
+
viewerUrl += `&pagemode=${this.pagemode}`;
|
|
284
|
+
}
|
|
285
|
+
if (this.errorOverride || this.errorAppend) {
|
|
286
|
+
viewerUrl += `&errorMessage=${this.errorMessage}`;
|
|
287
|
+
if (this.errorOverride) {
|
|
288
|
+
viewerUrl += `&errorOverride=${this.errorOverride}`;
|
|
289
|
+
}
|
|
290
|
+
if (this.errorAppend) {
|
|
291
|
+
viewerUrl += `&errorAppend=${this.errorAppend}`;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (this.externalWindow) {
|
|
295
|
+
this.viewerTab.location.href = viewerUrl;
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
this.iframe.nativeElement.src = viewerUrl;
|
|
299
|
+
}
|
|
300
|
+
// console.log(`
|
|
301
|
+
// pdfSrc = ${this.pdfSrc}
|
|
302
|
+
// fileUrl = ${fileUrl}
|
|
303
|
+
// externalWindow = ${this.externalWindow}
|
|
304
|
+
// downloadFileName = ${this.downloadFileName}
|
|
305
|
+
// viewerFolder = ${this.viewerFolder}
|
|
306
|
+
// openFile = ${this.openFile}
|
|
307
|
+
// download = ${this.download}
|
|
308
|
+
// startDownload = ${this.startDownload}
|
|
309
|
+
// viewBookmark = ${this.viewBookmark}
|
|
310
|
+
// print = ${this.print}
|
|
311
|
+
// startPrint = ${this.startPrint}
|
|
312
|
+
// fullScreen = ${this.fullScreen}
|
|
313
|
+
// find = ${this.find}
|
|
314
|
+
// lastPage = ${this.lastPage}
|
|
315
|
+
// rotatecw = ${this.rotatecw}
|
|
316
|
+
// rotateccw = ${this.rotateccw}
|
|
317
|
+
// cursor = ${this.cursor}
|
|
318
|
+
// scrollMode = ${this.scroll}
|
|
319
|
+
// spread = ${this.spread}
|
|
320
|
+
// page = ${this.page}
|
|
321
|
+
// zoom = ${this.zoom}
|
|
322
|
+
// nameddest = ${this.nameddest}
|
|
323
|
+
// pagemode = ${this.pagemode}
|
|
324
|
+
// pagemode = ${this.errorOverride}
|
|
325
|
+
// pagemode = ${this.errorAppend}
|
|
326
|
+
// pagemode = ${this.errorMessage}
|
|
327
|
+
// `);
|
|
328
|
+
}
|
|
329
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
330
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.4", type: PdfJsViewerComponent, selector: "ng2-pdfjs-viewer", inputs: { viewerId: "viewerId", viewerFolder: "viewerFolder", externalWindow: "externalWindow", target: "target", showSpinner: "showSpinner", downloadFileName: "downloadFileName", openFile: "openFile", download: "download", startDownload: "startDownload", viewBookmark: "viewBookmark", print: "print", startPrint: "startPrint", fullScreen: "fullScreen", find: "find", zoom: "zoom", nameddest: "nameddest", pagemode: "pagemode", lastPage: "lastPage", rotatecw: "rotatecw", rotateccw: "rotateccw", cursor: "cursor", scroll: "scroll", spread: "spread", locale: "locale", useOnlyCssZoom: "useOnlyCssZoom", errorOverride: "errorOverride", errorAppend: "errorAppend", errorMessage: "errorMessage", diagnosticLogs: "diagnosticLogs", externalWindowOptions: "externalWindowOptions", page: "page", pdfSrc: "pdfSrc" }, outputs: { onBeforePrint: "onBeforePrint", onAfterPrint: "onAfterPrint", onDocumentLoad: "onDocumentLoad", onPageChange: "onPageChange" }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true, static: true }], ngImport: i0, template: `<iframe title="ng2-pdfjs-viewer" [hidden]="externalWindow || (!externalWindow && !pdfSrc)" #iframe width="100%" height="100%"></iframe>`, isInline: true });
|
|
331
|
+
}
|
|
332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerComponent, decorators: [{
|
|
333
|
+
type: Component,
|
|
334
|
+
args: [{
|
|
335
|
+
selector: 'ng2-pdfjs-viewer',
|
|
336
|
+
template: `<iframe title="ng2-pdfjs-viewer" [hidden]="externalWindow || (!externalWindow && !pdfSrc)" #iframe width="100%" height="100%"></iframe>`
|
|
337
|
+
}]
|
|
338
|
+
}], propDecorators: { iframe: [{
|
|
339
|
+
type: ViewChild,
|
|
340
|
+
args: ['iframe', { static: true }]
|
|
341
|
+
}], viewerId: [{
|
|
342
|
+
type: Input
|
|
343
|
+
}], onBeforePrint: [{
|
|
344
|
+
type: Output
|
|
345
|
+
}], onAfterPrint: [{
|
|
346
|
+
type: Output
|
|
347
|
+
}], onDocumentLoad: [{
|
|
348
|
+
type: Output
|
|
349
|
+
}], onPageChange: [{
|
|
350
|
+
type: Output
|
|
351
|
+
}], viewerFolder: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}], externalWindow: [{
|
|
354
|
+
type: Input
|
|
355
|
+
}], target: [{
|
|
356
|
+
type: Input
|
|
357
|
+
}], showSpinner: [{
|
|
358
|
+
type: Input
|
|
359
|
+
}], downloadFileName: [{
|
|
360
|
+
type: Input
|
|
361
|
+
}], openFile: [{
|
|
362
|
+
type: Input
|
|
363
|
+
}], download: [{
|
|
364
|
+
type: Input
|
|
365
|
+
}], startDownload: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}], viewBookmark: [{
|
|
368
|
+
type: Input
|
|
369
|
+
}], print: [{
|
|
370
|
+
type: Input
|
|
371
|
+
}], startPrint: [{
|
|
372
|
+
type: Input
|
|
373
|
+
}], fullScreen: [{
|
|
374
|
+
type: Input
|
|
375
|
+
}], find: [{
|
|
376
|
+
type: Input
|
|
377
|
+
}], zoom: [{
|
|
378
|
+
type: Input
|
|
379
|
+
}], nameddest: [{
|
|
380
|
+
type: Input
|
|
381
|
+
}], pagemode: [{
|
|
382
|
+
type: Input
|
|
383
|
+
}], lastPage: [{
|
|
384
|
+
type: Input
|
|
385
|
+
}], rotatecw: [{
|
|
386
|
+
type: Input
|
|
387
|
+
}], rotateccw: [{
|
|
388
|
+
type: Input
|
|
389
|
+
}], cursor: [{
|
|
390
|
+
type: Input
|
|
391
|
+
}], scroll: [{
|
|
392
|
+
type: Input
|
|
393
|
+
}], spread: [{
|
|
394
|
+
type: Input
|
|
395
|
+
}], locale: [{
|
|
396
|
+
type: Input
|
|
397
|
+
}], useOnlyCssZoom: [{
|
|
398
|
+
type: Input
|
|
399
|
+
}], errorOverride: [{
|
|
400
|
+
type: Input
|
|
401
|
+
}], errorAppend: [{
|
|
402
|
+
type: Input
|
|
403
|
+
}], errorMessage: [{
|
|
404
|
+
type: Input
|
|
405
|
+
}], diagnosticLogs: [{
|
|
406
|
+
type: Input
|
|
407
|
+
}], externalWindowOptions: [{
|
|
408
|
+
type: Input
|
|
409
|
+
}], page: [{
|
|
410
|
+
type: Input
|
|
411
|
+
}], pdfSrc: [{
|
|
412
|
+
type: Input
|
|
384
413
|
}] } });
|
|
385
414
|
|
|
386
|
-
class PdfJsViewerModule {
|
|
387
|
-
static forRoot() {
|
|
388
|
-
return {
|
|
389
|
-
ngModule: PdfJsViewerModule,
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
397
|
-
type: NgModule,
|
|
398
|
-
args: [{
|
|
399
|
-
imports: [CommonModule],
|
|
400
|
-
declarations: [PdfJsViewerComponent],
|
|
401
|
-
exports: [PdfJsViewerComponent],
|
|
402
|
-
}]
|
|
415
|
+
class PdfJsViewerModule {
|
|
416
|
+
static forRoot() {
|
|
417
|
+
return {
|
|
418
|
+
ngModule: PdfJsViewerModule,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
422
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerModule, declarations: [PdfJsViewerComponent], imports: [CommonModule], exports: [PdfJsViewerComponent] });
|
|
423
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerModule, imports: [CommonModule] });
|
|
424
|
+
}
|
|
425
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: PdfJsViewerModule, decorators: [{
|
|
426
|
+
type: NgModule,
|
|
427
|
+
args: [{
|
|
428
|
+
imports: [CommonModule],
|
|
429
|
+
declarations: [PdfJsViewerComponent],
|
|
430
|
+
exports: [PdfJsViewerComponent],
|
|
431
|
+
}]
|
|
403
432
|
}] });
|
|
404
433
|
|
|
405
|
-
/**
|
|
406
|
-
* Generated bundle index. Do not edit.
|
|
434
|
+
/**
|
|
435
|
+
* Generated bundle index. Do not edit.
|
|
407
436
|
*/
|
|
408
437
|
|
|
409
438
|
export { PdfJsViewerComponent, PdfJsViewerModule };
|