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.
@@ -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
- constructor() {
7
- this.onBeforePrint = new EventEmitter();
8
- this.onAfterPrint = new EventEmitter();
9
- this.onDocumentLoad = new EventEmitter();
10
- this.onPageChange = new EventEmitter();
11
- this.externalWindow = false;
12
- this.showSpinner = true;
13
- this.openFile = true;
14
- this.download = true;
15
- this.viewBookmark = true;
16
- this.print = true;
17
- this.fullScreen = true;
18
- //@Input() public showFullScreen: boolean;
19
- this.find = true;
20
- this.useOnlyCssZoom = false;
21
- this.errorOverride = false;
22
- this.errorAppend = true;
23
- this.diagnosticLogs = true;
24
- }
25
- set page(_page) {
26
- this._page = _page;
27
- if (this.PDFViewerApplication) {
28
- this.PDFViewerApplication.page = this._page;
29
- }
30
- else {
31
- if (this.diagnosticLogs)
32
- 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;)");
33
- }
34
- }
35
- get page() {
36
- if (this.PDFViewerApplication) {
37
- return this.PDFViewerApplication.page;
38
- }
39
- else {
40
- if (this.diagnosticLogs)
41
- console.warn("Document is not loaded yet!!!. Try to retrieve page# after full load.");
42
- }
43
- }
44
- set pdfSrc(_src) {
45
- this._src = _src;
46
- }
47
- get pdfSrc() {
48
- return this._src;
49
- }
50
- get PDFViewerApplicationOptions() {
51
- let pdfViewerOptions = null;
52
- if (this.externalWindow) {
53
- if (this.viewerTab) {
54
- pdfViewerOptions = this.viewerTab.PDFViewerApplicationOptions;
55
- }
56
- }
57
- else {
58
- if (this.iframe.nativeElement.contentWindow) {
59
- pdfViewerOptions = this.iframe.nativeElement.contentWindow.PDFViewerApplicationOptions;
60
- }
61
- }
62
- return pdfViewerOptions;
63
- }
64
- get PDFViewerApplication() {
65
- let pdfViewer = null;
66
- if (this.externalWindow) {
67
- if (this.viewerTab) {
68
- pdfViewer = this.viewerTab.PDFViewerApplication;
69
- }
70
- }
71
- else {
72
- if (this.iframe.nativeElement.contentWindow) {
73
- pdfViewer = this.iframe.nativeElement.contentWindow.PDFViewerApplication;
74
- }
75
- }
76
- return pdfViewer;
77
- }
78
- receiveMessage(viewerEvent) {
79
- if (viewerEvent.data && viewerEvent.data.viewerId && viewerEvent.data.event) {
80
- let viewerId = viewerEvent.data.viewerId;
81
- let event = viewerEvent.data.event;
82
- let param = viewerEvent.data.param;
83
- if (this.viewerId == viewerId) {
84
- if (this.onBeforePrint && event == "beforePrint") {
85
- this.onBeforePrint.emit();
86
- }
87
- else if (this.onAfterPrint && event == "afterPrint") {
88
- this.onAfterPrint.emit();
89
- }
90
- else if (this.onDocumentLoad && event == "pagesLoaded") {
91
- this.onDocumentLoad.emit(param);
92
- }
93
- else if (this.onPageChange && event == "pageChange") {
94
- this.onPageChange.emit(param);
95
- }
96
- }
97
- }
98
- }
99
- ngOnInit() {
100
- window.addEventListener("message", this.receiveMessage.bind(this), false);
101
- if (!this.externalWindow) { // Load pdf for embedded views
102
- this.loadPdf();
103
- }
104
- }
105
- refresh() {
106
- this.loadPdf();
107
- }
108
- loadPdf() {
109
- if (!this._src) {
110
- return;
111
- }
112
- // console.log(`Tab is - ${this.viewerTab}`);
113
- // if (this.viewerTab) {
114
- // console.log(`Status of window - ${this.viewerTab.closed}`);
115
- // }
116
- if (this.externalWindow && (typeof this.viewerTab === 'undefined' || this.viewerTab.closed)) {
117
- this.viewerTab = window.open('', '_blank', this.externalWindowOptions || '');
118
- if (this.viewerTab == null) {
119
- if (this.diagnosticLogs)
120
- console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled.");
121
- return;
122
- }
123
- if (this.showSpinner) {
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
- let fileUrl;
151
- //if (typeof this.src === "string") {
152
- // fileUrl = this.src;
153
- //}
154
- if (this._src instanceof Blob) {
155
- fileUrl = encodeURIComponent(URL.createObjectURL(this._src));
156
- }
157
- else if (this._src instanceof Uint8Array) {
158
- let blob = new Blob([this._src], { type: "application/pdf" });
159
- fileUrl = encodeURIComponent(URL.createObjectURL(blob));
160
- }
161
- else {
162
- fileUrl = this._src;
163
- }
164
- let viewerUrl;
165
- if (this.viewerFolder) {
166
- viewerUrl = `${this.viewerFolder}/web/viewer.html`;
167
- }
168
- else {
169
- viewerUrl = `assets/pdfjs/web/viewer.html`;
170
- }
171
- viewerUrl += `?file=${fileUrl}`;
172
- if (typeof this.viewerId !== 'undefined') {
173
- viewerUrl += `&viewerId=${this.viewerId}`;
174
- }
175
- if (typeof this.onBeforePrint !== 'undefined') {
176
- viewerUrl += `&beforePrint=true`;
177
- }
178
- if (typeof this.onAfterPrint !== 'undefined') {
179
- viewerUrl += `&afterPrint=true`;
180
- }
181
- if (typeof this.onDocumentLoad !== 'undefined') {
182
- viewerUrl += `&pagesLoaded=true`;
183
- }
184
- if (typeof this.onPageChange !== 'undefined') {
185
- viewerUrl += `&pageChange=true`;
186
- }
187
- if (this.downloadFileName) {
188
- if (!this.downloadFileName.endsWith(".pdf")) {
189
- this.downloadFileName += ".pdf";
190
- }
191
- viewerUrl += `&fileName=${this.downloadFileName}`;
192
- }
193
- if (typeof this.openFile !== 'undefined') {
194
- viewerUrl += `&openFile=${this.openFile}`;
195
- }
196
- if (typeof this.download !== 'undefined') {
197
- viewerUrl += `&download=${this.download}`;
198
- }
199
- if (this.startDownload) {
200
- viewerUrl += `&startDownload=${this.startDownload}`;
201
- }
202
- if (typeof this.viewBookmark !== 'undefined') {
203
- viewerUrl += `&viewBookmark=${this.viewBookmark}`;
204
- }
205
- if (typeof this.print !== 'undefined') {
206
- viewerUrl += `&print=${this.print}`;
207
- }
208
- if (this.startPrint) {
209
- viewerUrl += `&startPrint=${this.startPrint}`;
210
- }
211
- if (typeof this.fullScreen !== 'undefined') {
212
- viewerUrl += `&fullScreen=${this.fullScreen}`;
213
- }
214
- // if (this.showFullScreen) {
215
- // viewerUrl += `&showFullScreen=${this.showFullScreen}`;
216
- // }
217
- if (typeof this.find !== 'undefined') {
218
- viewerUrl += `&find=${this.find}`;
219
- }
220
- if (this.lastPage) {
221
- viewerUrl += `&lastpage=${this.lastPage}`;
222
- }
223
- if (this.rotatecw) {
224
- viewerUrl += `&rotatecw=${this.rotatecw}`;
225
- }
226
- if (this.rotateccw) {
227
- viewerUrl += `&rotateccw=${this.rotateccw}`;
228
- }
229
- if (this.cursor) {
230
- viewerUrl += `&cursor=${this.cursor}`;
231
- }
232
- if (this.scroll) {
233
- viewerUrl += `&scroll=${this.scroll}`;
234
- }
235
- if (this.spread) {
236
- viewerUrl += `&spread=${this.spread}`;
237
- }
238
- if (this.locale) {
239
- viewerUrl += `&locale=${this.locale}`;
240
- }
241
- if (this.useOnlyCssZoom) {
242
- viewerUrl += `&useOnlyCssZoom=${this.useOnlyCssZoom}`;
243
- }
244
- if (this._page || this.zoom || this.nameddest || this.pagemode)
245
- viewerUrl += "#";
246
- if (this._page) {
247
- viewerUrl += `&page=${this._page}`;
248
- }
249
- if (this.zoom) {
250
- viewerUrl += `&zoom=${this.zoom}`;
251
- }
252
- if (this.nameddest) {
253
- viewerUrl += `&nameddest=${this.nameddest}`;
254
- }
255
- if (this.pagemode) {
256
- viewerUrl += `&pagemode=${this.pagemode}`;
257
- }
258
- if (this.errorOverride || this.errorAppend) {
259
- viewerUrl += `&errorMessage=${this.errorMessage}`;
260
- if (this.errorOverride) {
261
- viewerUrl += `&errorOverride=${this.errorOverride}`;
262
- }
263
- if (this.errorAppend) {
264
- viewerUrl += `&errorAppend=${this.errorAppend}`;
265
- }
266
- }
267
- if (this.externalWindow) {
268
- this.viewerTab.location.href = viewerUrl;
269
- }
270
- else {
271
- this.iframe.nativeElement.src = viewerUrl;
272
- }
273
- // console.log(`
274
- // pdfSrc = ${this.pdfSrc}
275
- // fileUrl = ${fileUrl}
276
- // externalWindow = ${this.externalWindow}
277
- // downloadFileName = ${this.downloadFileName}
278
- // viewerFolder = ${this.viewerFolder}
279
- // openFile = ${this.openFile}
280
- // download = ${this.download}
281
- // startDownload = ${this.startDownload}
282
- // viewBookmark = ${this.viewBookmark}
283
- // print = ${this.print}
284
- // startPrint = ${this.startPrint}
285
- // fullScreen = ${this.fullScreen}
286
- // find = ${this.find}
287
- // lastPage = ${this.lastPage}
288
- // rotatecw = ${this.rotatecw}
289
- // rotateccw = ${this.rotateccw}
290
- // cursor = ${this.cursor}
291
- // scrollMode = ${this.scroll}
292
- // spread = ${this.spread}
293
- // page = ${this.page}
294
- // zoom = ${this.zoom}
295
- // nameddest = ${this.nameddest}
296
- // pagemode = ${this.pagemode}
297
- // pagemode = ${this.errorOverride}
298
- // pagemode = ${this.errorAppend}
299
- // pagemode = ${this.errorMessage}
300
- // `);
301
- }
302
- }
303
- PdfJsViewerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
304
- PdfJsViewerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: PdfJsViewerComponent, selector: "ng2-pdfjs-viewer", inputs: { viewerId: "viewerId", viewerFolder: "viewerFolder", externalWindow: "externalWindow", 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 });
305
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerComponent, decorators: [{
306
- type: Component,
307
- args: [{
308
- selector: 'ng2-pdfjs-viewer',
309
- template: `<iframe title="ng2-pdfjs-viewer" [hidden]="externalWindow || (!externalWindow && !pdfSrc)" #iframe width="100%" height="100%"></iframe>`
310
- }]
311
- }], propDecorators: { iframe: [{
312
- type: ViewChild,
313
- args: ['iframe', { static: true }]
314
- }], viewerId: [{
315
- type: Input
316
- }], onBeforePrint: [{
317
- type: Output
318
- }], onAfterPrint: [{
319
- type: Output
320
- }], onDocumentLoad: [{
321
- type: Output
322
- }], onPageChange: [{
323
- type: Output
324
- }], viewerFolder: [{
325
- type: Input
326
- }], externalWindow: [{
327
- type: Input
328
- }], showSpinner: [{
329
- type: Input
330
- }], downloadFileName: [{
331
- type: Input
332
- }], openFile: [{
333
- type: Input
334
- }], download: [{
335
- type: Input
336
- }], startDownload: [{
337
- type: Input
338
- }], viewBookmark: [{
339
- type: Input
340
- }], print: [{
341
- type: Input
342
- }], startPrint: [{
343
- type: Input
344
- }], fullScreen: [{
345
- type: Input
346
- }], find: [{
347
- type: Input
348
- }], zoom: [{
349
- type: Input
350
- }], nameddest: [{
351
- type: Input
352
- }], pagemode: [{
353
- type: Input
354
- }], lastPage: [{
355
- type: Input
356
- }], rotatecw: [{
357
- type: Input
358
- }], rotateccw: [{
359
- type: Input
360
- }], cursor: [{
361
- type: Input
362
- }], scroll: [{
363
- type: Input
364
- }], spread: [{
365
- type: Input
366
- }], locale: [{
367
- type: Input
368
- }], useOnlyCssZoom: [{
369
- type: Input
370
- }], errorOverride: [{
371
- type: Input
372
- }], errorAppend: [{
373
- type: Input
374
- }], errorMessage: [{
375
- type: Input
376
- }], diagnosticLogs: [{
377
- type: Input
378
- }], externalWindowOptions: [{
379
- type: Input
380
- }], page: [{
381
- type: Input
382
- }], pdfSrc: [{
383
- type: Input
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
- PdfJsViewerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
394
- PdfJsViewerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerModule, declarations: [PdfJsViewerComponent], imports: [CommonModule], exports: [PdfJsViewerComponent] });
395
- PdfJsViewerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerModule, imports: [[CommonModule]] });
396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PdfJsViewerModule, decorators: [{
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 };