ng2-pdfjs-viewer
Advanced tools
Comparing version 4.0.5 to 5.0.0
107
index.js
@@ -26,3 +26,34 @@ import { Component, EventEmitter, Input, NgModule, Output, ViewChild } from '@angular/core'; | ||
this.errorAppend = true; | ||
this.diagnosticLogs = true; | ||
} | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "page", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
if (this.PDFViewerApplication) { | ||
return this.PDFViewerApplication.page; | ||
} | ||
else { | ||
if (this.diagnosticLogs) | ||
console.warn("Document is not loaded yet!!!. Try to retrieve page# after full load."); | ||
} | ||
}, | ||
set: /** | ||
* @param {?} _page | ||
* @return {?} | ||
*/ | ||
function (_page) { | ||
this._page = _page; | ||
if (this.PDFViewerApplication) { | ||
this.PDFViewerApplication.page = this._page; | ||
} | ||
else { | ||
if (this.diagnosticLogs) | ||
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;)"); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "pdfSrc", { | ||
@@ -33,10 +64,10 @@ get: /** | ||
function () { | ||
return this.innerSrc; | ||
return this._src; | ||
}, | ||
set: /** | ||
* @param {?} innerSrc | ||
* @param {?} _src | ||
* @return {?} | ||
*/ | ||
function (innerSrc) { | ||
this.innerSrc = innerSrc; | ||
function (_src) { | ||
this._src = _src; | ||
}, | ||
@@ -46,2 +77,46 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "PDFViewerApplicationOptions", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
/** @type {?} */ | ||
var pdfViewerOptions = null; | ||
if (this.externalWindow) { | ||
if (this.viewerTab) { | ||
pdfViewerOptions = this.viewerTab.PDFViewerApplicationOptions; | ||
} | ||
} | ||
else { | ||
if (this.iframe.nativeElement.contentWindow) { | ||
pdfViewerOptions = this.iframe.nativeElement.contentWindow.PDFViewerApplicationOptions; | ||
} | ||
} | ||
return pdfViewerOptions; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "PDFViewerApplication", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
/** @type {?} */ | ||
var pdfViewer = null; | ||
if (this.externalWindow) { | ||
if (this.viewerTab) { | ||
pdfViewer = this.viewerTab.PDFViewerApplication; | ||
} | ||
} | ||
else { | ||
if (this.iframe.nativeElement.contentWindow) { | ||
pdfViewer = this.iframe.nativeElement.contentWindow.PDFViewerApplication; | ||
} | ||
} | ||
return pdfViewer; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -109,3 +184,3 @@ * @param {?} viewerEvent | ||
function () { | ||
if (!this.innerSrc) { | ||
if (!this._src) { | ||
return; | ||
@@ -120,3 +195,4 @@ } | ||
if (this.viewerTab == null) { | ||
console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled."); | ||
if (this.diagnosticLogs) | ||
console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled."); | ||
return; | ||
@@ -133,12 +209,12 @@ } | ||
//} | ||
if (this.innerSrc instanceof Blob) { | ||
fileUrl = encodeURIComponent(URL.createObjectURL(this.innerSrc)); | ||
if (this._src instanceof Blob) { | ||
fileUrl = encodeURIComponent(URL.createObjectURL(this._src)); | ||
} | ||
else if (this.innerSrc instanceof Uint8Array) { | ||
else if (this._src instanceof Uint8Array) { | ||
/** @type {?} */ | ||
var blob = new Blob([this.innerSrc], { type: "application/pdf" }); | ||
var blob = new Blob([this._src], { type: "application/pdf" }); | ||
fileUrl = encodeURIComponent(URL.createObjectURL(blob)); | ||
} | ||
else { | ||
fileUrl = this.innerSrc; | ||
fileUrl = this._src; | ||
} | ||
@@ -226,6 +302,6 @@ /** @type {?} */ | ||
} | ||
if (this.page || this.zoom || this.nameddest || this.pagemode) | ||
if (this._page || this.zoom || this.nameddest || this.pagemode) | ||
viewerUrl += "#"; | ||
if (this.page) { | ||
viewerUrl += "&page=" + this.page; | ||
if (this._page) { | ||
viewerUrl += "&page=" + this._page; | ||
} | ||
@@ -310,3 +386,2 @@ if (this.zoom) { | ||
find: [{ type: Input }], | ||
page: [{ type: Input }], | ||
zoom: [{ type: Input }], | ||
@@ -326,3 +401,5 @@ nameddest: [{ type: Input }], | ||
errorMessage: [{ type: Input }], | ||
diagnosticLogs: [{ type: Input }], | ||
externalWindowOptions: [{ type: Input }], | ||
page: [{ type: Input }], | ||
pdfSrc: [{ type: Input }] | ||
@@ -329,0 +406,0 @@ }; |
@@ -21,3 +21,2 @@ import { EventEmitter, ElementRef } from '@angular/core'; | ||
find: boolean; | ||
page: number; | ||
zoom: string; | ||
@@ -37,6 +36,11 @@ nameddest: string; | ||
errorMessage: string; | ||
diagnosticLogs: boolean; | ||
externalWindowOptions: string; | ||
viewerTab: any; | ||
private innerSrc; | ||
private _src; | ||
private _page; | ||
page: number; | ||
pdfSrc: string | Blob | Uint8Array; | ||
readonly PDFViewerApplicationOptions: any; | ||
readonly PDFViewerApplication: any; | ||
receiveMessage(viewerEvent: any): void; | ||
@@ -43,0 +47,0 @@ ngOnInit(): void; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"PdfJsViewerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":4}],"declarations":[{"__symbolic":"reference","name":"PdfJsViewerComponent"}],"exports":[{"__symbolic":"reference","name":"PdfJsViewerComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"PdfJsViewerModule"}}}}},"PdfJsViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"ng2-pdfjs-viewer","template":"<iframe [hidden]=\"externalWindow || (!externalWindow && !pdfSrc)\" #iframe width=\"100%\" height=\"100%\"></iframe>"}]}],"members":{"iframe":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":7,"character":3},"arguments":["iframe"]}]}],"viewerId":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"onBeforePrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":9,"character":3}}]}],"onAfterPrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":10,"character":3}}]}],"onDocumentLoad":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":11,"character":3}}]}],"onPageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":12,"character":3}}]}],"viewerFolder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"externalWindow":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"showSpinner":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"downloadFileName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":3}}]}],"openFile":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"download":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"startDownload":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"viewBookmark":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"print":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"startPrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"fullScreen":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"find":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"nameddest":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"pagemode":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"lastPage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"rotatecw":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":3}}]}],"rotateccw":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"cursor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"scroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"spread":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"locale":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"useOnlyCssZoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"errorOverride":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"errorAppend":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"errorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"externalWindowOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}}]}],"pdfSrc":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":46,"character":3}}]}],"receiveMessage":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"refresh":[{"__symbolic":"method"}],"loadPdf":[{"__symbolic":"method"}]}}},"origins":{"PdfJsViewerModule":"./index","PdfJsViewerComponent":"./ng2-pdfjs-viewer.component"},"importAs":"ng2-pdfjs-viewer"} | ||
{"__symbolic":"module","version":4,"metadata":{"PdfJsViewerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":4}],"declarations":[{"__symbolic":"reference","name":"PdfJsViewerComponent"}],"exports":[{"__symbolic":"reference","name":"PdfJsViewerComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"PdfJsViewerModule"}}}}},"PdfJsViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"ng2-pdfjs-viewer","template":"<iframe [hidden]=\"externalWindow || (!externalWindow && !pdfSrc)\" #iframe width=\"100%\" height=\"100%\"></iframe>"}]}],"members":{"iframe":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":7,"character":3},"arguments":["iframe"]}]}],"viewerId":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"onBeforePrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":9,"character":3}}]}],"onAfterPrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":10,"character":3}}]}],"onDocumentLoad":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":11,"character":3}}]}],"onPageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":12,"character":3}}]}],"viewerFolder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"externalWindow":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"showSpinner":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"downloadFileName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":3}}]}],"openFile":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"download":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"startDownload":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"viewBookmark":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"print":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"startPrint":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"fullScreen":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"find":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"nameddest":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"pagemode":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"lastPage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"rotatecw":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"rotateccw":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":3}}]}],"cursor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"scroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"spread":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"locale":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"useOnlyCssZoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"errorOverride":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"errorAppend":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"errorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"diagnosticLogs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"externalWindowOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":3}}]}],"pdfSrc":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":3}}]}],"receiveMessage":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"refresh":[{"__symbolic":"method"}],"loadPdf":[{"__symbolic":"method"}]}}},"origins":{"PdfJsViewerModule":"./index","PdfJsViewerComponent":"./ng2-pdfjs-viewer.component"},"importAs":"ng2-pdfjs-viewer"} |
@@ -29,3 +29,34 @@ (function (global, factory) { | ||
this.errorAppend = true; | ||
this.diagnosticLogs = true; | ||
} | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "page", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
if (this.PDFViewerApplication) { | ||
return this.PDFViewerApplication.page; | ||
} | ||
else { | ||
if (this.diagnosticLogs) | ||
console.warn("Document is not loaded yet!!!. Try to retrieve page# after full load."); | ||
} | ||
}, | ||
set: /** | ||
* @param {?} _page | ||
* @return {?} | ||
*/ | ||
function (_page) { | ||
this._page = _page; | ||
if (this.PDFViewerApplication) { | ||
this.PDFViewerApplication.page = this._page; | ||
} | ||
else { | ||
if (this.diagnosticLogs) | ||
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;)"); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "pdfSrc", { | ||
@@ -36,10 +67,10 @@ get: /** | ||
function () { | ||
return this.innerSrc; | ||
return this._src; | ||
}, | ||
set: /** | ||
* @param {?} innerSrc | ||
* @param {?} _src | ||
* @return {?} | ||
*/ | ||
function (innerSrc) { | ||
this.innerSrc = innerSrc; | ||
function (_src) { | ||
this._src = _src; | ||
}, | ||
@@ -49,2 +80,46 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "PDFViewerApplicationOptions", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
/** @type {?} */ | ||
var pdfViewerOptions = null; | ||
if (this.externalWindow) { | ||
if (this.viewerTab) { | ||
pdfViewerOptions = this.viewerTab.PDFViewerApplicationOptions; | ||
} | ||
} | ||
else { | ||
if (this.iframe.nativeElement.contentWindow) { | ||
pdfViewerOptions = this.iframe.nativeElement.contentWindow.PDFViewerApplicationOptions; | ||
} | ||
} | ||
return pdfViewerOptions; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(PdfJsViewerComponent.prototype, "PDFViewerApplication", { | ||
get: /** | ||
* @return {?} | ||
*/ | ||
function () { | ||
/** @type {?} */ | ||
var pdfViewer = null; | ||
if (this.externalWindow) { | ||
if (this.viewerTab) { | ||
pdfViewer = this.viewerTab.PDFViewerApplication; | ||
} | ||
} | ||
else { | ||
if (this.iframe.nativeElement.contentWindow) { | ||
pdfViewer = this.iframe.nativeElement.contentWindow.PDFViewerApplication; | ||
} | ||
} | ||
return pdfViewer; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -112,3 +187,3 @@ * @param {?} viewerEvent | ||
function () { | ||
if (!this.innerSrc) { | ||
if (!this._src) { | ||
return; | ||
@@ -123,3 +198,4 @@ } | ||
if (this.viewerTab == null) { | ||
console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled."); | ||
if (this.diagnosticLogs) | ||
console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled."); | ||
return; | ||
@@ -136,12 +212,12 @@ } | ||
//} | ||
if (this.innerSrc instanceof Blob) { | ||
fileUrl = encodeURIComponent(URL.createObjectURL(this.innerSrc)); | ||
if (this._src instanceof Blob) { | ||
fileUrl = encodeURIComponent(URL.createObjectURL(this._src)); | ||
} | ||
else if (this.innerSrc instanceof Uint8Array) { | ||
else if (this._src instanceof Uint8Array) { | ||
/** @type {?} */ | ||
var blob = new Blob([this.innerSrc], { type: "application/pdf" }); | ||
var blob = new Blob([this._src], { type: "application/pdf" }); | ||
fileUrl = encodeURIComponent(URL.createObjectURL(blob)); | ||
} | ||
else { | ||
fileUrl = this.innerSrc; | ||
fileUrl = this._src; | ||
} | ||
@@ -229,6 +305,6 @@ /** @type {?} */ | ||
} | ||
if (this.page || this.zoom || this.nameddest || this.pagemode) | ||
if (this._page || this.zoom || this.nameddest || this.pagemode) | ||
viewerUrl += "#"; | ||
if (this.page) { | ||
viewerUrl += "&page=" + this.page; | ||
if (this._page) { | ||
viewerUrl += "&page=" + this._page; | ||
} | ||
@@ -313,3 +389,2 @@ if (this.zoom) { | ||
find: [{ type: core.Input }], | ||
page: [{ type: core.Input }], | ||
zoom: [{ type: core.Input }], | ||
@@ -329,3 +404,5 @@ nameddest: [{ type: core.Input }], | ||
errorMessage: [{ type: core.Input }], | ||
diagnosticLogs: [{ type: core.Input }], | ||
externalWindowOptions: [{ type: core.Input }], | ||
page: [{ type: core.Input }], | ||
pdfSrc: [{ type: core.Input }] | ||
@@ -332,0 +409,0 @@ }; |
{ | ||
"name": "ng2-pdfjs-viewer", | ||
"version": "4.0.5", | ||
"version": "5.0.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -11,3 +11,3 @@ # Angular 8 PDFJS viewer with Mozilla's ViewerJS (Supports Angular 2/4/5/6/7/8) | ||
This is a super simple angular 8 component for displaying pdfs inline(embedded) OR in a new tab along with a feature rich viewer. It uses mozilla's pdfjs viewer(v2.2.171) behind the scenes and supports angular(2/4/5/6/7). Extremely lightweight, easiest to integrate and use, most reliable, this library has only one dependancy (@angular/core). Thanks a ton to the community, standing tall around 250,000 downloads!!! | ||
This is a super simple angular 8 component for displaying pdfs inline(embedded) OR in a new tab along with a feature rich viewer. It uses mozilla's pdfjs viewer(v2.2.171) behind the scenes and supports angular(2/4/5/6/7). Extremely lightweight, easiest to integrate and use, most reliable, this library has only one dependancy (@angular/core). Thanks a ton to the community, standing tall over 250,000 downloads!!! | ||
@@ -26,2 +26,3 @@ ## What is new? | ||
✔️ **Open pdf in new window** 🌐 - Opens pdf viewer in new window. Also, you may set all allowable external window options. | ||
✔️ **Direct access to document** 🌐 - Exposed PDFApplication and PDFApplicationOptions objects opens a whole world of existing PDFJS and ViewerJS to the user, allowing to change them programmatically; thus producing a unique viewer experience. | ||
✔️ **Embed pdf** 🗎 - Embeds viewer and pdf inside your web page/component. | ||
@@ -31,2 +32,3 @@ ✔️ **Blob and byte arrays** 🔟 - Have pdf as a byte array? Still works. | ||
✔️ **Print preview** 🖨️ - You can set the pdf to open in a new tab or another browser window and provide an immediate print preview, A use case will be a 'Print' button opening pdf in new window with print dialog. | ||
✔️ **Defaults** - There are a ton of built in functionality Mozilla's viewer supports; such as print, download, bookmark, fullscreen, open file, zoom, search, pan, spread, navigate, attachments etc which is also available as-is in this viewer. Not mentioning them individually. | ||
✔️ **Auto download** 💾 - This option allows you to download the pdf file to user device automatically without manually invoking the download. | ||
@@ -46,4 +48,4 @@ ✔️ **Auto rotate** 🔄 - Rotate the document _clockwise_ or _anti-clockwise_ 90° (+/- 90°) just before displaying. Useful if the document is misaligned. | ||
✔️ **Spread** - Allows you to change spread to odd or even. | ||
✔️ **Other** - There are a ton of built in functionality Mozilla's viewer supports, which is also available as-is in this viewer. | ||
### Open in a new tab/ external window | ||
@@ -114,2 +116,4 @@ <img src="/sampledoc/viewerImage.JPG" alt="angular 8 pdfjs viewer in new window"/> | ||
| `[pdfSrc]` | Fully qualified path to pdf file. (For remote pdf urls over http/https, CORS should be enabled) | `string` | | | ||
| `PDFViewerApplication` | This public property exposes underlying PDFViewerApplication object. Make sure to access it after document is loaded. Opens up the whole world of underlying PDFJS properties and methods. Use it to customize the viewer and document experience. | `object` | | | ||
| `PDFViewerApplicationOptions` | This public property exposes underlying PDFViewerApplicationOptions object. Make sure to access it after document is loaded. Opens up the whole world of underlying PDFJS options. Use it to customize the viewer and document experience. | `object` | | | ||
| `[viewerFolder]` | Set path to _pdfjs's_ `web` and `build` folders. | `string` | `assets` folder path | | ||
@@ -123,3 +127,3 @@ | `[externalWindow]` | Open in new tab. Set to `true` to open document in a new tab | `boolean` | `false` | | ||
| `downloadFileName` | Sets/Changes the name of document to be downloaded. If the file name does not ends in `.pdf`, the component will automatically add it for you. | `string` | Actual name of the document | | ||
| `[page]` | Show specific page. E.g _page=3_ | `number` | `1` | | ||
| `[page]` | Show specific page. E.g _page=3_. You may also get/set the page number from your component using '.' notation explicitly, after document is loaded. E.g. `myPdfViewer.page = 3;` | `number` | `1` | | ||
| `[lastPage]` | Show last page of the document once it is loaded(If set to `true`). If you use this option along with _`page`_ option, undesired effects might occur | `boolean` | `false` | | ||
@@ -149,5 +153,5 @@ | `nameddest` | Go to a named destination. E.g. To go to section _5.1_ use like nameddest=5.1. Do not mix this option with _`page`_ and _`lastPage`_ options | `string` | | | ||
| `[errorOverride]` | Overrides all pdfjs error messages and shows only user's custom error message | boolean | `false` | | ||
| `[diagnosticLogs]` | Turns on all diagnostic logs to the console | boolean | `true` | | ||
**_Please note, copy step is mandatory to enjoy all of the different options listed above. You may also avoid this step and could directly use https://github.com/mozilla/pdf.js/wiki/Setup-pdf.js-in-a-website if you wish to just use the default viewer_** | ||
@@ -154,0 +158,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11949147
84116
305