ng2-pdfjs-viewer 25.0.12 → 25.0.14
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 +12 -0
- package/fesm2022/ng2-pdfjs-viewer.mjs +189 -174
- package/fesm2022/ng2-pdfjs-viewer.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/pdfjs/web/postmessage-wrapper.js +12 -0
- package/pdfjs/web/viewer.css +5 -0
- package/pdfjs/web/viewer.html +1 -1
package/README.md
CHANGED
|
@@ -939,6 +939,18 @@ This project is licensed under the **Apache License 2.0 + Commons Clause License
|
|
|
939
939
|
<div align="center">
|
|
940
940
|
|
|
941
941
|
|
|
942
|
+
## 🔒 Security
|
|
943
|
+
|
|
944
|
+
I take security of this library seriously. If you discover a security vulnerability, please report it privately:
|
|
945
|
+
|
|
946
|
+
- **🔒 Private Reporting**: [Security Policy](https://github.com/intbot/ng2-pdfjs-viewer/security/policy)
|
|
947
|
+
- **📧 Email**: [codehippie1@gmail.com](mailto:codehippie1@gmail.com)
|
|
948
|
+
- **⚠️ Please do NOT** report security issues through public GitHub issues
|
|
949
|
+
|
|
950
|
+
For security best practices and vulnerability reporting guidelines, see our [Security Policy](https://github.com/intbot/ng2-pdfjs-viewer/security/policy).
|
|
951
|
+
|
|
952
|
+
---
|
|
953
|
+
|
|
942
954
|
[](https://github.com/intbot/ng2-pdfjs-viewer)
|
|
943
955
|
[](https://www.npmjs.com/package/ng2-pdfjs-viewer)
|
|
944
956
|
[](https://angular.dev/overview)
|
|
@@ -477,6 +477,15 @@ class PdfJsViewerComponent {
|
|
|
477
477
|
...this.errorTemplateData,
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
|
+
// Helper method to get iframe CSS classes
|
|
481
|
+
getIframeClasses() {
|
|
482
|
+
const classes = ['ng2-pdfjs-viewer-iframe'];
|
|
483
|
+
// Add border class if iframeBorder is set and not "0"
|
|
484
|
+
if (this.iframeBorder && this.iframeBorder !== "0" && this.iframeBorder !== 0) {
|
|
485
|
+
classes.push('has-border');
|
|
486
|
+
}
|
|
487
|
+
return classes.join(' ');
|
|
488
|
+
}
|
|
480
489
|
// Error template button actions
|
|
481
490
|
reloadViewer() {
|
|
482
491
|
this.refresh();
|
|
@@ -960,11 +969,10 @@ class PdfJsViewerComponent {
|
|
|
960
969
|
this.actionQueueManager.updateReadiness(this.postMessageReadiness);
|
|
961
970
|
this.actionQueueManager.processQueuedActions();
|
|
962
971
|
}
|
|
963
|
-
//
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
972
|
+
// Always (re)apply initial configurations when PostMessage API is ready.
|
|
973
|
+
// This makes reloads idempotently reconfigure the viewer.
|
|
974
|
+
this.queueAllConfigurations();
|
|
975
|
+
this.initialConfigQueued = true;
|
|
968
976
|
// Apply any pending changes that occurred before PostMessage API was ready
|
|
969
977
|
this.applyPendingChanges();
|
|
970
978
|
return;
|
|
@@ -1638,29 +1646,29 @@ class PdfJsViewerComponent {
|
|
|
1638
1646
|
}
|
|
1639
1647
|
}
|
|
1640
1648
|
renderLoadingSpinner() {
|
|
1641
|
-
this.viewerTab.document.write(`
|
|
1642
|
-
<style>
|
|
1643
|
-
.loader {
|
|
1644
|
-
position: fixed;
|
|
1645
|
-
left: 40%;
|
|
1646
|
-
top: 40%;
|
|
1647
|
-
border: 16px solid #f3f3f3;
|
|
1648
|
-
border-radius: 50%;
|
|
1649
|
-
border-top: 16px solid #3498db;
|
|
1650
|
-
width: 120px;
|
|
1651
|
-
height: 120px;
|
|
1652
|
-
animation: spin 2s linear infinite;
|
|
1653
|
-
}
|
|
1654
|
-
@keyframes spin {
|
|
1655
|
-
0% {
|
|
1656
|
-
transform: rotate(0deg);
|
|
1657
|
-
}
|
|
1658
|
-
100% {
|
|
1659
|
-
transform: rotate(360deg);
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
</style>
|
|
1663
|
-
<div class="loader"></div>
|
|
1649
|
+
this.viewerTab.document.write(`
|
|
1650
|
+
<style>
|
|
1651
|
+
.loader {
|
|
1652
|
+
position: fixed;
|
|
1653
|
+
left: 40%;
|
|
1654
|
+
top: 40%;
|
|
1655
|
+
border: 16px solid #f3f3f3;
|
|
1656
|
+
border-radius: 50%;
|
|
1657
|
+
border-top: 16px solid #3498db;
|
|
1658
|
+
width: 120px;
|
|
1659
|
+
height: 120px;
|
|
1660
|
+
animation: spin 2s linear infinite;
|
|
1661
|
+
}
|
|
1662
|
+
@keyframes spin {
|
|
1663
|
+
0% {
|
|
1664
|
+
transform: rotate(0deg);
|
|
1665
|
+
}
|
|
1666
|
+
100% {
|
|
1667
|
+
transform: rotate(360deg);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
</style>
|
|
1671
|
+
<div class="loader"></div>
|
|
1664
1672
|
`);
|
|
1665
1673
|
}
|
|
1666
1674
|
createFileUrl() {
|
|
@@ -1671,7 +1679,9 @@ class PdfJsViewerComponent {
|
|
|
1671
1679
|
return encodeURIComponent(url);
|
|
1672
1680
|
}
|
|
1673
1681
|
else if (this._src instanceof Uint8Array) {
|
|
1674
|
-
|
|
1682
|
+
// Ensure BlobPart type safety by passing ArrayBuffer
|
|
1683
|
+
const arrayBuffer = this._src.buffer;
|
|
1684
|
+
let blob = new Blob([arrayBuffer], { type: "application/pdf" });
|
|
1675
1685
|
const url = URL.createObjectURL(blob);
|
|
1676
1686
|
this.relaseUrl = () => URL.revokeObjectURL(url);
|
|
1677
1687
|
return encodeURIComponent(url);
|
|
@@ -1684,6 +1694,7 @@ class PdfJsViewerComponent {
|
|
|
1684
1694
|
let viewerUrl = this.getBaseViewerUrl();
|
|
1685
1695
|
viewerUrl = this.addFileParameter(viewerUrl, fileUrl);
|
|
1686
1696
|
viewerUrl = this.addViewerIdParameter(viewerUrl);
|
|
1697
|
+
viewerUrl = this.addUrlValidationParameter(viewerUrl);
|
|
1687
1698
|
viewerUrl = this.addCacheBustingIfNeeded(viewerUrl);
|
|
1688
1699
|
return viewerUrl;
|
|
1689
1700
|
}
|
|
@@ -1700,6 +1711,10 @@ class PdfJsViewerComponent {
|
|
|
1700
1711
|
? `${viewerUrl}&viewerId=${this.viewerId}`
|
|
1701
1712
|
: viewerUrl;
|
|
1702
1713
|
}
|
|
1714
|
+
addUrlValidationParameter(viewerUrl) {
|
|
1715
|
+
const flag = this.urlValidation === false ? 0 : 1;
|
|
1716
|
+
return `${viewerUrl}&urlValidation=${flag}`;
|
|
1717
|
+
}
|
|
1703
1718
|
addCacheBustingIfNeeded(viewerUrl) {
|
|
1704
1719
|
if (this.isDevelopmentMode()) {
|
|
1705
1720
|
const cacheBuster = Date.now();
|
|
@@ -1727,37 +1742,37 @@ class PdfJsViewerComponent {
|
|
|
1727
1742
|
}
|
|
1728
1743
|
}
|
|
1729
1744
|
logViewerConfiguration(viewerUrl) {
|
|
1730
|
-
console.debug(`PdfJsViewer: Minimal URL configuration:
|
|
1731
|
-
pdfSrc = ${this.pdfSrc}
|
|
1732
|
-
externalWindow = ${this.externalWindow}
|
|
1733
|
-
viewerFolder = ${this.viewerFolder}
|
|
1734
|
-
viewerId = ${this.viewerId}
|
|
1735
|
-
finalUrl = ${viewerUrl}
|
|
1736
|
-
|
|
1737
|
-
All other configurations handled via PostMessage system:
|
|
1738
|
-
showOpenFile = ${this.showOpenFile}
|
|
1739
|
-
showDownload = ${this.showDownload}
|
|
1740
|
-
showViewBookmark = ${this.showViewBookmark}
|
|
1741
|
-
showPrint = ${this.showPrint}
|
|
1742
|
-
showFullScreen = ${this.showFullScreen}
|
|
1743
|
-
showFind = ${this.showFind}
|
|
1744
|
-
cursor = ${this.cursor}
|
|
1745
|
-
scroll = ${this.scroll}
|
|
1746
|
-
spread = ${this.spread}
|
|
1747
|
-
page = ${this.page}
|
|
1748
|
-
zoom = ${this.zoom}
|
|
1749
|
-
namedDest = ${this.namedDest}
|
|
1750
|
-
pageMode = ${this.pageMode}
|
|
1751
|
-
errorOverride = ${this.errorOverride}
|
|
1752
|
-
errorAppend = ${this.errorAppend}
|
|
1753
|
-
errorMessage = ${this.errorMessage}
|
|
1754
|
-
locale = ${this.locale}
|
|
1755
|
-
useOnlyCssZoom = ${this.useOnlyCssZoom}
|
|
1756
|
-
|
|
1757
|
-
Auto-actions (handled by action queue):
|
|
1758
|
-
downloadOnLoad = ${this.downloadOnLoad}
|
|
1759
|
-
printOnLoad = ${this.printOnLoad}
|
|
1760
|
-
showLastPageOnLoad = ${this.showLastPageOnLoad}
|
|
1745
|
+
console.debug(`PdfJsViewer: Minimal URL configuration:
|
|
1746
|
+
pdfSrc = ${this.pdfSrc}
|
|
1747
|
+
externalWindow = ${this.externalWindow}
|
|
1748
|
+
viewerFolder = ${this.viewerFolder}
|
|
1749
|
+
viewerId = ${this.viewerId}
|
|
1750
|
+
finalUrl = ${viewerUrl}
|
|
1751
|
+
|
|
1752
|
+
All other configurations handled via PostMessage system:
|
|
1753
|
+
showOpenFile = ${this.showOpenFile}
|
|
1754
|
+
showDownload = ${this.showDownload}
|
|
1755
|
+
showViewBookmark = ${this.showViewBookmark}
|
|
1756
|
+
showPrint = ${this.showPrint}
|
|
1757
|
+
showFullScreen = ${this.showFullScreen}
|
|
1758
|
+
showFind = ${this.showFind}
|
|
1759
|
+
cursor = ${this.cursor}
|
|
1760
|
+
scroll = ${this.scroll}
|
|
1761
|
+
spread = ${this.spread}
|
|
1762
|
+
page = ${this.page}
|
|
1763
|
+
zoom = ${this.zoom}
|
|
1764
|
+
namedDest = ${this.namedDest}
|
|
1765
|
+
pageMode = ${this.pageMode}
|
|
1766
|
+
errorOverride = ${this.errorOverride}
|
|
1767
|
+
errorAppend = ${this.errorAppend}
|
|
1768
|
+
errorMessage = ${this.errorMessage}
|
|
1769
|
+
locale = ${this.locale}
|
|
1770
|
+
useOnlyCssZoom = ${this.useOnlyCssZoom}
|
|
1771
|
+
|
|
1772
|
+
Auto-actions (handled by action queue):
|
|
1773
|
+
downloadOnLoad = ${this.downloadOnLoad}
|
|
1774
|
+
printOnLoad = ${this.printOnLoad}
|
|
1775
|
+
showLastPageOnLoad = ${this.showLastPageOnLoad}
|
|
1761
1776
|
`);
|
|
1762
1777
|
}
|
|
1763
1778
|
// #endregion
|
|
@@ -1884,123 +1899,123 @@ class PdfJsViewerComponent {
|
|
|
1884
1899
|
return this.postMessageReadiness >= requiredLevel;
|
|
1885
1900
|
}
|
|
1886
1901
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PdfJsViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1887
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PdfJsViewerComponent, isStandalone: false, selector: "ng2-pdfjs-viewer", inputs: { viewerId: "viewerId", viewerFolder: "viewerFolder", externalWindow: "externalWindow", target: "target", showSpinner: "showSpinner", downloadFileName: "downloadFileName", locale: "locale", useOnlyCssZoom: "useOnlyCssZoom", diagnosticLogs: "diagnosticLogs", showOpenFile: "showOpenFile", showAnnotations: "showAnnotations", showDownload: "showDownload", showViewBookmark: "showViewBookmark", showPrint: "showPrint", showFullScreen: "showFullScreen", showFind: "showFind", downloadOnLoad: "downloadOnLoad", printOnLoad: "printOnLoad", rotateCW: "rotateCW", rotateCCW: "rotateCCW", showLastPageOnLoad: "showLastPageOnLoad", namedDest: "namedDest", errorOverride: "errorOverride", errorAppend: "errorAppend", errorMessage: "errorMessage", urlValidation: "urlValidation", customSecurityTpl: "customSecurityTpl", theme: "theme", primaryColor: "primaryColor", backgroundColor: "backgroundColor", pageBorderColor: "pageBorderColor", pageSpacing: "pageSpacing", toolbarColor: "toolbarColor", textColor: "textColor", borderRadius: "borderRadius", customCSS: "customCSS", cspNonce: "cspNonce", iframeTitle: "iframeTitle", customSpinnerTpl: "customSpinnerTpl", spinnerClass: "spinnerClass", customErrorTpl: "customErrorTpl", errorClass: "errorClass", showToolbarLeft: "showToolbarLeft", showToolbarMiddle: "showToolbarMiddle", showToolbarRight: "showToolbarRight", showSecondaryToolbarToggle: "showSecondaryToolbarToggle", showSidebar: "showSidebar", showSidebarLeft: "showSidebarLeft", showSidebarRight: "showSidebarRight", toolbarDensity: "toolbarDensity", sidebarWidth: "sidebarWidth", toolbarPosition: "toolbarPosition", sidebarPosition: "sidebarPosition", responsiveBreakpoint: "responsiveBreakpoint", controlVisibility: "controlVisibility", autoActions: "autoActions", errorHandling: "errorHandling", viewerConfig: "viewerConfig", themeConfig: "themeConfig", groupVisibility: "groupVisibility", layoutConfig: "layoutConfig", startDownload: "startDownload", startPrint: "startPrint", openFile: "openFile", download: "download", print: "print", fullScreen: "fullScreen", find: "find", viewBookmark: "viewBookmark", lastPage: "lastPage", externalWindowOptions: "externalWindowOptions", iframeBorder: "iframeBorder", zoom: "zoom", rotation: "rotation", cursor: "cursor", scroll: "scroll", spread: "spread", pageMode: "pageMode", page: "page", pdfSrc: "pdfSrc" }, outputs: { onBeforePrint: "onBeforePrint", onAfterPrint: "onAfterPrint", onDocumentLoad: "onDocumentLoad", onPageChange: "onPageChange", onScaleChange: "onScaleChange", onRotationChange: "onRotationChange", onDocumentError: "onDocumentError", onDocumentInit: "onDocumentInit", onPagesInit: "onPagesInit", onPresentationModeChanged: "onPresentationModeChanged", onOpenFile: "onOpenFile", onFind: "onFind", onUpdateFindMatchesCount: "onUpdateFindMatchesCount", onMetadataLoaded: "onMetadataLoaded", onOutlineLoaded: "onOutlineLoaded", onPageRendered: "onPageRendered", onAnnotationLayerRendered: "onAnnotationLayerRendered", onBookmarkClick: "onBookmarkClick", onIdle: "onIdle", zoomChange: "zoomChange", cursorChange: "cursorChange", scrollChange: "scrollChange", spreadChange: "spreadChange", pageModeChange: "pageModeChange" }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1888
|
-
<div class="ng2-pdfjs-viewer-container">
|
|
1889
|
-
<iframe
|
|
1890
|
-
[title]="iframeTitle || 'PDF document viewer'"
|
|
1891
|
-
[hidden]="externalWindow || (!externalWindow && !pdfSrc)"
|
|
1892
|
-
sandbox="allow-forms allow-scripts allow-same-origin allow-modals"
|
|
1893
|
-
[
|
|
1894
|
-
#iframe
|
|
1895
|
-
width="100%"
|
|
1896
|
-
height="100%"
|
|
1897
|
-
></iframe>
|
|
1898
|
-
|
|
1899
|
-
<div
|
|
1900
|
-
class="ng2-pdfjs-loading-overlay"
|
|
1901
|
-
*ngIf="showSpinner && isLoading && !externalWindow"
|
|
1902
|
-
[ngClass]="spinnerClass"
|
|
1903
|
-
>
|
|
1904
|
-
<ng-container
|
|
1905
|
-
*ngIf="customSpinnerTpl; else defaultSpinner"
|
|
1906
|
-
[ngTemplateOutlet]="customSpinnerTpl"
|
|
1907
|
-
></ng-container>
|
|
1908
|
-
<ng-template #defaultSpinner>
|
|
1909
|
-
<div class="ng2-pdfjs-spinner-content">
|
|
1910
|
-
<div class="ng2-pdfjs-spinner-icon"></div>
|
|
1911
|
-
<div class="ng2-pdfjs-spinner-text">
|
|
1912
|
-
Loading PDF...
|
|
1913
|
-
</div>
|
|
1914
|
-
</div>
|
|
1915
|
-
</ng-template>
|
|
1916
|
-
</div>
|
|
1917
|
-
|
|
1918
|
-
<div
|
|
1919
|
-
class="ng2-pdfjs-error-overlay"
|
|
1920
|
-
*ngIf="errorOverride && hasError && !externalWindow"
|
|
1921
|
-
[ngClass]="errorClass"
|
|
1922
|
-
>
|
|
1923
|
-
<ng-container
|
|
1924
|
-
*ngIf="customErrorTpl; else defaultError"
|
|
1925
|
-
[ngTemplateOutlet]="customErrorTpl"
|
|
1926
|
-
[ngTemplateOutletContext]="getErrorTemplateData()"
|
|
1927
|
-
></ng-container>
|
|
1928
|
-
<ng-template #defaultError>
|
|
1929
|
-
<div class="ng2-pdfjs-error-content">
|
|
1930
|
-
<div class="ng2-pdfjs-error-icon">
|
|
1931
|
-
⚠️
|
|
1932
|
-
</div>
|
|
1933
|
-
<div class="ng2-pdfjs-error-title">
|
|
1934
|
-
Error Loading PDF
|
|
1935
|
-
</div>
|
|
1936
|
-
<div class="ng2-pdfjs-error-message">
|
|
1937
|
-
{{ currentErrorMessage }}
|
|
1938
|
-
</div>
|
|
1939
|
-
</div>
|
|
1940
|
-
</ng-template>
|
|
1941
|
-
</div>
|
|
1942
|
-
</div>
|
|
1943
|
-
`, isInline: true, styles: [".ng2-pdfjs-viewer-container{position:relative;width:100%;height:100%}.ng2-pdfjs-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fff9;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-spinner-content{text-align:center}.ng2-pdfjs-spinner-icon{display:inline-block;width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #2196F3;border-radius:50%;animation:spin 1s linear infinite}.ng2-pdfjs-spinner-text{margin-top:16px;color:#666;font-size:16px}.ng2-pdfjs-error-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#ffffffe6;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-error-content{text-align:center;max-width:400px;padding:20px}.ng2-pdfjs-error-icon{font-size:48px;color:#f44336;margin-bottom:16px}.ng2-pdfjs-error-title{color:#333;font-size:18px;font-weight:500;margin-bottom:8px}.ng2-pdfjs-error-message{color:#666;font-size:14px;line-height:1.4}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1902
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PdfJsViewerComponent, isStandalone: false, selector: "ng2-pdfjs-viewer", inputs: { viewerId: "viewerId", viewerFolder: "viewerFolder", externalWindow: "externalWindow", target: "target", showSpinner: "showSpinner", downloadFileName: "downloadFileName", locale: "locale", useOnlyCssZoom: "useOnlyCssZoom", diagnosticLogs: "diagnosticLogs", showOpenFile: "showOpenFile", showAnnotations: "showAnnotations", showDownload: "showDownload", showViewBookmark: "showViewBookmark", showPrint: "showPrint", showFullScreen: "showFullScreen", showFind: "showFind", downloadOnLoad: "downloadOnLoad", printOnLoad: "printOnLoad", rotateCW: "rotateCW", rotateCCW: "rotateCCW", showLastPageOnLoad: "showLastPageOnLoad", namedDest: "namedDest", errorOverride: "errorOverride", errorAppend: "errorAppend", errorMessage: "errorMessage", urlValidation: "urlValidation", customSecurityTpl: "customSecurityTpl", theme: "theme", primaryColor: "primaryColor", backgroundColor: "backgroundColor", pageBorderColor: "pageBorderColor", pageSpacing: "pageSpacing", toolbarColor: "toolbarColor", textColor: "textColor", borderRadius: "borderRadius", customCSS: "customCSS", cspNonce: "cspNonce", iframeTitle: "iframeTitle", customSpinnerTpl: "customSpinnerTpl", spinnerClass: "spinnerClass", customErrorTpl: "customErrorTpl", errorClass: "errorClass", showToolbarLeft: "showToolbarLeft", showToolbarMiddle: "showToolbarMiddle", showToolbarRight: "showToolbarRight", showSecondaryToolbarToggle: "showSecondaryToolbarToggle", showSidebar: "showSidebar", showSidebarLeft: "showSidebarLeft", showSidebarRight: "showSidebarRight", toolbarDensity: "toolbarDensity", sidebarWidth: "sidebarWidth", toolbarPosition: "toolbarPosition", sidebarPosition: "sidebarPosition", responsiveBreakpoint: "responsiveBreakpoint", controlVisibility: "controlVisibility", autoActions: "autoActions", errorHandling: "errorHandling", viewerConfig: "viewerConfig", themeConfig: "themeConfig", groupVisibility: "groupVisibility", layoutConfig: "layoutConfig", startDownload: "startDownload", startPrint: "startPrint", openFile: "openFile", download: "download", print: "print", fullScreen: "fullScreen", find: "find", viewBookmark: "viewBookmark", lastPage: "lastPage", externalWindowOptions: "externalWindowOptions", iframeBorder: "iframeBorder", zoom: "zoom", rotation: "rotation", cursor: "cursor", scroll: "scroll", spread: "spread", pageMode: "pageMode", page: "page", pdfSrc: "pdfSrc" }, outputs: { onBeforePrint: "onBeforePrint", onAfterPrint: "onAfterPrint", onDocumentLoad: "onDocumentLoad", onPageChange: "onPageChange", onScaleChange: "onScaleChange", onRotationChange: "onRotationChange", onDocumentError: "onDocumentError", onDocumentInit: "onDocumentInit", onPagesInit: "onPagesInit", onPresentationModeChanged: "onPresentationModeChanged", onOpenFile: "onOpenFile", onFind: "onFind", onUpdateFindMatchesCount: "onUpdateFindMatchesCount", onMetadataLoaded: "onMetadataLoaded", onOutlineLoaded: "onOutlineLoaded", onPageRendered: "onPageRendered", onAnnotationLayerRendered: "onAnnotationLayerRendered", onBookmarkClick: "onBookmarkClick", onIdle: "onIdle", zoomChange: "zoomChange", cursorChange: "cursorChange", scrollChange: "scrollChange", spreadChange: "spreadChange", pageModeChange: "pageModeChange" }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1903
|
+
<div class="ng2-pdfjs-viewer-container">
|
|
1904
|
+
<iframe
|
|
1905
|
+
[title]="iframeTitle || 'PDF document viewer'"
|
|
1906
|
+
[hidden]="externalWindow || (!externalWindow && !pdfSrc)"
|
|
1907
|
+
sandbox="allow-forms allow-scripts allow-same-origin allow-modals"
|
|
1908
|
+
[class]="getIframeClasses()"
|
|
1909
|
+
#iframe
|
|
1910
|
+
width="100%"
|
|
1911
|
+
height="100%"
|
|
1912
|
+
></iframe>
|
|
1913
|
+
|
|
1914
|
+
<div
|
|
1915
|
+
class="ng2-pdfjs-loading-overlay"
|
|
1916
|
+
*ngIf="showSpinner && isLoading && !externalWindow"
|
|
1917
|
+
[ngClass]="spinnerClass"
|
|
1918
|
+
>
|
|
1919
|
+
<ng-container
|
|
1920
|
+
*ngIf="customSpinnerTpl; else defaultSpinner"
|
|
1921
|
+
[ngTemplateOutlet]="customSpinnerTpl"
|
|
1922
|
+
></ng-container>
|
|
1923
|
+
<ng-template #defaultSpinner>
|
|
1924
|
+
<div class="ng2-pdfjs-spinner-content">
|
|
1925
|
+
<div class="ng2-pdfjs-spinner-icon"></div>
|
|
1926
|
+
<div class="ng2-pdfjs-spinner-text">
|
|
1927
|
+
Loading PDF...
|
|
1928
|
+
</div>
|
|
1929
|
+
</div>
|
|
1930
|
+
</ng-template>
|
|
1931
|
+
</div>
|
|
1932
|
+
|
|
1933
|
+
<div
|
|
1934
|
+
class="ng2-pdfjs-error-overlay"
|
|
1935
|
+
*ngIf="errorOverride && hasError && !externalWindow"
|
|
1936
|
+
[ngClass]="errorClass"
|
|
1937
|
+
>
|
|
1938
|
+
<ng-container
|
|
1939
|
+
*ngIf="customErrorTpl; else defaultError"
|
|
1940
|
+
[ngTemplateOutlet]="customErrorTpl"
|
|
1941
|
+
[ngTemplateOutletContext]="getErrorTemplateData()"
|
|
1942
|
+
></ng-container>
|
|
1943
|
+
<ng-template #defaultError>
|
|
1944
|
+
<div class="ng2-pdfjs-error-content">
|
|
1945
|
+
<div class="ng2-pdfjs-error-icon">
|
|
1946
|
+
⚠️
|
|
1947
|
+
</div>
|
|
1948
|
+
<div class="ng2-pdfjs-error-title">
|
|
1949
|
+
Error Loading PDF
|
|
1950
|
+
</div>
|
|
1951
|
+
<div class="ng2-pdfjs-error-message">
|
|
1952
|
+
{{ currentErrorMessage }}
|
|
1953
|
+
</div>
|
|
1954
|
+
</div>
|
|
1955
|
+
</ng-template>
|
|
1956
|
+
</div>
|
|
1957
|
+
</div>
|
|
1958
|
+
`, isInline: true, styles: [".ng2-pdfjs-viewer-container{position:relative;width:100%;height:100%}.ng2-pdfjs-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fff9;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-spinner-content{text-align:center}.ng2-pdfjs-spinner-icon{display:inline-block;width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #2196F3;border-radius:50%;animation:spin 1s linear infinite}.ng2-pdfjs-spinner-text{margin-top:16px;color:#666;font-size:16px}.ng2-pdfjs-error-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#ffffffe6;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-error-content{text-align:center;max-width:400px;padding:20px}.ng2-pdfjs-error-icon{font-size:48px;color:#f44336;margin-bottom:16px}.ng2-pdfjs-error-title{color:#333;font-size:18px;font-weight:500;margin-bottom:8px}.ng2-pdfjs-error-message{color:#666;font-size:14px;line-height:1.4}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ng2-pdfjs-viewer-iframe{border:0}.ng2-pdfjs-viewer-iframe.has-border{border:1px solid #ccc}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1944
1959
|
}
|
|
1945
1960
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PdfJsViewerComponent, decorators: [{
|
|
1946
1961
|
type: Component,
|
|
1947
|
-
args: [{ selector: "ng2-pdfjs-viewer", standalone: false, template: `
|
|
1948
|
-
<div class="ng2-pdfjs-viewer-container">
|
|
1949
|
-
<iframe
|
|
1950
|
-
[title]="iframeTitle || 'PDF document viewer'"
|
|
1951
|
-
[hidden]="externalWindow || (!externalWindow && !pdfSrc)"
|
|
1952
|
-
sandbox="allow-forms allow-scripts allow-same-origin allow-modals"
|
|
1953
|
-
[
|
|
1954
|
-
#iframe
|
|
1955
|
-
width="100%"
|
|
1956
|
-
height="100%"
|
|
1957
|
-
></iframe>
|
|
1958
|
-
|
|
1959
|
-
<div
|
|
1960
|
-
class="ng2-pdfjs-loading-overlay"
|
|
1961
|
-
*ngIf="showSpinner && isLoading && !externalWindow"
|
|
1962
|
-
[ngClass]="spinnerClass"
|
|
1963
|
-
>
|
|
1964
|
-
<ng-container
|
|
1965
|
-
*ngIf="customSpinnerTpl; else defaultSpinner"
|
|
1966
|
-
[ngTemplateOutlet]="customSpinnerTpl"
|
|
1967
|
-
></ng-container>
|
|
1968
|
-
<ng-template #defaultSpinner>
|
|
1969
|
-
<div class="ng2-pdfjs-spinner-content">
|
|
1970
|
-
<div class="ng2-pdfjs-spinner-icon"></div>
|
|
1971
|
-
<div class="ng2-pdfjs-spinner-text">
|
|
1972
|
-
Loading PDF...
|
|
1973
|
-
</div>
|
|
1974
|
-
</div>
|
|
1975
|
-
</ng-template>
|
|
1976
|
-
</div>
|
|
1977
|
-
|
|
1978
|
-
<div
|
|
1979
|
-
class="ng2-pdfjs-error-overlay"
|
|
1980
|
-
*ngIf="errorOverride && hasError && !externalWindow"
|
|
1981
|
-
[ngClass]="errorClass"
|
|
1982
|
-
>
|
|
1983
|
-
<ng-container
|
|
1984
|
-
*ngIf="customErrorTpl; else defaultError"
|
|
1985
|
-
[ngTemplateOutlet]="customErrorTpl"
|
|
1986
|
-
[ngTemplateOutletContext]="getErrorTemplateData()"
|
|
1987
|
-
></ng-container>
|
|
1988
|
-
<ng-template #defaultError>
|
|
1989
|
-
<div class="ng2-pdfjs-error-content">
|
|
1990
|
-
<div class="ng2-pdfjs-error-icon">
|
|
1991
|
-
⚠️
|
|
1992
|
-
</div>
|
|
1993
|
-
<div class="ng2-pdfjs-error-title">
|
|
1994
|
-
Error Loading PDF
|
|
1995
|
-
</div>
|
|
1996
|
-
<div class="ng2-pdfjs-error-message">
|
|
1997
|
-
{{ currentErrorMessage }}
|
|
1998
|
-
</div>
|
|
1999
|
-
</div>
|
|
2000
|
-
</ng-template>
|
|
2001
|
-
</div>
|
|
2002
|
-
</div>
|
|
2003
|
-
`, styles: [".ng2-pdfjs-viewer-container{position:relative;width:100%;height:100%}.ng2-pdfjs-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fff9;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-spinner-content{text-align:center}.ng2-pdfjs-spinner-icon{display:inline-block;width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #2196F3;border-radius:50%;animation:spin 1s linear infinite}.ng2-pdfjs-spinner-text{margin-top:16px;color:#666;font-size:16px}.ng2-pdfjs-error-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#ffffffe6;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-error-content{text-align:center;max-width:400px;padding:20px}.ng2-pdfjs-error-icon{font-size:48px;color:#f44336;margin-bottom:16px}.ng2-pdfjs-error-title{color:#333;font-size:18px;font-weight:500;margin-bottom:8px}.ng2-pdfjs-error-message{color:#666;font-size:14px;line-height:1.4}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
1962
|
+
args: [{ selector: "ng2-pdfjs-viewer", standalone: false, template: `
|
|
1963
|
+
<div class="ng2-pdfjs-viewer-container">
|
|
1964
|
+
<iframe
|
|
1965
|
+
[title]="iframeTitle || 'PDF document viewer'"
|
|
1966
|
+
[hidden]="externalWindow || (!externalWindow && !pdfSrc)"
|
|
1967
|
+
sandbox="allow-forms allow-scripts allow-same-origin allow-modals"
|
|
1968
|
+
[class]="getIframeClasses()"
|
|
1969
|
+
#iframe
|
|
1970
|
+
width="100%"
|
|
1971
|
+
height="100%"
|
|
1972
|
+
></iframe>
|
|
1973
|
+
|
|
1974
|
+
<div
|
|
1975
|
+
class="ng2-pdfjs-loading-overlay"
|
|
1976
|
+
*ngIf="showSpinner && isLoading && !externalWindow"
|
|
1977
|
+
[ngClass]="spinnerClass"
|
|
1978
|
+
>
|
|
1979
|
+
<ng-container
|
|
1980
|
+
*ngIf="customSpinnerTpl; else defaultSpinner"
|
|
1981
|
+
[ngTemplateOutlet]="customSpinnerTpl"
|
|
1982
|
+
></ng-container>
|
|
1983
|
+
<ng-template #defaultSpinner>
|
|
1984
|
+
<div class="ng2-pdfjs-spinner-content">
|
|
1985
|
+
<div class="ng2-pdfjs-spinner-icon"></div>
|
|
1986
|
+
<div class="ng2-pdfjs-spinner-text">
|
|
1987
|
+
Loading PDF...
|
|
1988
|
+
</div>
|
|
1989
|
+
</div>
|
|
1990
|
+
</ng-template>
|
|
1991
|
+
</div>
|
|
1992
|
+
|
|
1993
|
+
<div
|
|
1994
|
+
class="ng2-pdfjs-error-overlay"
|
|
1995
|
+
*ngIf="errorOverride && hasError && !externalWindow"
|
|
1996
|
+
[ngClass]="errorClass"
|
|
1997
|
+
>
|
|
1998
|
+
<ng-container
|
|
1999
|
+
*ngIf="customErrorTpl; else defaultError"
|
|
2000
|
+
[ngTemplateOutlet]="customErrorTpl"
|
|
2001
|
+
[ngTemplateOutletContext]="getErrorTemplateData()"
|
|
2002
|
+
></ng-container>
|
|
2003
|
+
<ng-template #defaultError>
|
|
2004
|
+
<div class="ng2-pdfjs-error-content">
|
|
2005
|
+
<div class="ng2-pdfjs-error-icon">
|
|
2006
|
+
⚠️
|
|
2007
|
+
</div>
|
|
2008
|
+
<div class="ng2-pdfjs-error-title">
|
|
2009
|
+
Error Loading PDF
|
|
2010
|
+
</div>
|
|
2011
|
+
<div class="ng2-pdfjs-error-message">
|
|
2012
|
+
{{ currentErrorMessage }}
|
|
2013
|
+
</div>
|
|
2014
|
+
</div>
|
|
2015
|
+
</ng-template>
|
|
2016
|
+
</div>
|
|
2017
|
+
</div>
|
|
2018
|
+
`, styles: [".ng2-pdfjs-viewer-container{position:relative;width:100%;height:100%}.ng2-pdfjs-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fff9;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-spinner-content{text-align:center}.ng2-pdfjs-spinner-icon{display:inline-block;width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #2196F3;border-radius:50%;animation:spin 1s linear infinite}.ng2-pdfjs-spinner-text{margin-top:16px;color:#666;font-size:16px}.ng2-pdfjs-error-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#ffffffe6;-webkit-backdrop-filter:saturate(120%) blur(1px);backdrop-filter:saturate(120%) blur(1px)}.ng2-pdfjs-error-content{text-align:center;max-width:400px;padding:20px}.ng2-pdfjs-error-icon{font-size:48px;color:#f44336;margin-bottom:16px}.ng2-pdfjs-error-title{color:#333;font-size:18px;font-weight:500;margin-bottom:8px}.ng2-pdfjs-error-message{color:#666;font-size:14px;line-height:1.4}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ng2-pdfjs-viewer-iframe{border:0}.ng2-pdfjs-viewer-iframe.has-border{border:1px solid #ccc}\n"] }]
|
|
2004
2019
|
}], propDecorators: { iframe: [{
|
|
2005
2020
|
type: ViewChild,
|
|
2006
2021
|
args: ["iframe", { static: true }]
|