@pdfslick/core 1.5.2 → 2.0.1
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/dist/esm/PDFSlick.d.ts +7 -4
- package/dist/esm/PDFSlick.d.ts.map +1 -1
- package/dist/esm/index.js +106 -89
- package/dist/esm/lib/pdf_presentation_mode.d.ts +1 -1
- package/dist/esm/lib/pdf_presentation_mode.d.ts.map +1 -1
- package/dist/esm/lib/pdf_print_service.d.ts +3 -3
- package/dist/esm/lib/pdf_print_service.d.ts.map +1 -1
- package/dist/esm/lib/pdf_rendering_queue.d.ts +1 -1
- package/dist/esm/lib/pdf_rendering_queue.d.ts.map +1 -1
- package/dist/esm/lib/pdf_thumbnail_view.d.ts +1 -1
- package/dist/esm/lib/pdf_thumbnail_view.d.ts.map +1 -1
- package/dist/esm/lib/pdf_thumbnail_viewer.d.ts +1 -1
- package/dist/esm/lib/pdf_thumbnail_viewer.d.ts.map +1 -1
- package/dist/esm/types.d.ts +3 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/pdf_viewer.css +2883 -2294
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +3 -26
- package/package.json +10 -7
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RenderingCancelledException, PixelsPerInch, getXfaPageViewport, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions, getPdfFilenameFromUrl, getDocument, PDFDateString } from 'pdfjs-dist';
|
|
2
|
-
import { SimpleLinkService, XfaLayerBuilder,
|
|
1
|
+
import { RenderingCancelledException, PixelsPerInch, getXfaPageViewport, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions, getPdfFilenameFromUrl, getDocument, AnnotationEditorParamsType, PDFDateString } from 'pdfjs-dist';
|
|
2
|
+
import { SimpleLinkService, XfaLayerBuilder, GenericL10n, DownloadManager, EventBus, PDFLinkService, PDFSinglePageViewer, PDFViewer } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
3
3
|
import { createStore } from 'zustand/vanilla';
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
@@ -646,11 +646,11 @@ class ProgressBar {
|
|
|
646
646
|
var _a, _b, _c;
|
|
647
647
|
__classPrivateFieldSet(this, _ProgressBar_percent, clamp(val, 0, 100), "f");
|
|
648
648
|
if (isNaN(val)) {
|
|
649
|
-
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a ===
|
|
649
|
+
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a === undefined ? undefined : _a.add("indeterminate");
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
|
-
(_b = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _b ===
|
|
653
|
-
(_c = __classPrivateFieldGet(this, _ProgressBar_style, "f")) === null || _c ===
|
|
652
|
+
(_b = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _b === undefined ? undefined : _b.remove("indeterminate");
|
|
653
|
+
(_c = __classPrivateFieldGet(this, _ProgressBar_style, "f")) === null || _c === undefined ? undefined : _c.setProperty("--progressBar-percent", `${__classPrivateFieldGet(this, _ProgressBar_percent, "f")}%`);
|
|
654
654
|
}
|
|
655
655
|
setWidth(viewer) {
|
|
656
656
|
var _a;
|
|
@@ -660,7 +660,7 @@ class ProgressBar {
|
|
|
660
660
|
const container = viewer.parentNode;
|
|
661
661
|
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
|
|
662
662
|
if (scrollbarWidth > 0) {
|
|
663
|
-
(_a = __classPrivateFieldGet(this, _ProgressBar_style, "f")) === null || _a ===
|
|
663
|
+
(_a = __classPrivateFieldGet(this, _ProgressBar_style, "f")) === null || _a === undefined ? undefined : _a.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
setDisableAutoFetch(delay = /* ms = */ 5000) {
|
|
@@ -682,7 +682,7 @@ class ProgressBar {
|
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
684
|
__classPrivateFieldSet(this, _ProgressBar_visible, false, "f");
|
|
685
|
-
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a ===
|
|
685
|
+
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a === undefined ? undefined : _a.add("hidden");
|
|
686
686
|
}
|
|
687
687
|
show() {
|
|
688
688
|
var _a;
|
|
@@ -690,7 +690,7 @@ class ProgressBar {
|
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
692
|
__classPrivateFieldSet(this, _ProgressBar_visible, true, "f");
|
|
693
|
-
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a ===
|
|
693
|
+
(_a = __classPrivateFieldGet(this, _ProgressBar_classList, "f")) === null || _a === undefined ? undefined : _a.remove("hidden");
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
_ProgressBar_classList = new WeakMap(), _ProgressBar_disableAutoFetchTimeout = new WeakMap(), _ProgressBar_percent = new WeakMap(), _ProgressBar_style = new WeakMap(), _ProgressBar_visible = new WeakMap();
|
|
@@ -705,7 +705,7 @@ _ProgressBar_classList = new WeakMap(), _ProgressBar_disableAutoFetchTimeout = n
|
|
|
705
705
|
function getActiveOrFocusedElement() {
|
|
706
706
|
let curRoot = document;
|
|
707
707
|
let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
|
|
708
|
-
while (curActiveOrFocused === null || curActiveOrFocused ===
|
|
708
|
+
while (curActiveOrFocused === null || curActiveOrFocused === undefined ? undefined : curActiveOrFocused.shadowRoot) {
|
|
709
709
|
curRoot = curActiveOrFocused.shadowRoot;
|
|
710
710
|
curActiveOrFocused =
|
|
711
711
|
curRoot.activeElement || curRoot.querySelector(":focus");
|
|
@@ -832,12 +832,12 @@ class PDFRenderingQueue {
|
|
|
832
832
|
this.idleTimeout = null;
|
|
833
833
|
}
|
|
834
834
|
// Pages have a higher priority than thumbnails, so check them first.
|
|
835
|
-
if ((_a = this.pdfViewer) === null || _a ===
|
|
835
|
+
if ((_a = this.pdfViewer) === null || _a === undefined ? undefined : _a.forceRendering(currentlyVisiblePages)) {
|
|
836
836
|
return;
|
|
837
837
|
}
|
|
838
838
|
// No pages needed rendering, so check thumbnails.
|
|
839
839
|
if (this.isThumbnailViewEnabled &&
|
|
840
|
-
((_b = this.pdfThumbnailViewer) === null || _b ===
|
|
840
|
+
((_b = this.pdfThumbnailViewer) === null || _b === undefined ? undefined : _b.forceRendering())) {
|
|
841
841
|
return;
|
|
842
842
|
}
|
|
843
843
|
if (this.printing) {
|
|
@@ -1141,7 +1141,7 @@ class PDFThumbnailView {
|
|
|
1141
1141
|
return Promise.reject(new Error("pdfPage is not loaded"));
|
|
1142
1142
|
}
|
|
1143
1143
|
this.renderingState = RenderingStates.RUNNING;
|
|
1144
|
-
const finishRenderTask = (error = null) => __awaiter(this,
|
|
1144
|
+
const finishRenderTask = (error = null) => __awaiter(this, undefined, undefined, function* () {
|
|
1145
1145
|
// The renderTask may have been replaced by a new one, so only remove
|
|
1146
1146
|
// the reference to the renderTask if it matches the one that is
|
|
1147
1147
|
// triggering this callback.
|
|
@@ -1251,13 +1251,13 @@ class PDFThumbnailView {
|
|
|
1251
1251
|
get _thumbPageTitle() {
|
|
1252
1252
|
var _b;
|
|
1253
1253
|
return this.l10n.get("thumb_page_title", {
|
|
1254
|
-
page: (_b = this.pageLabel) !== null && _b !==
|
|
1254
|
+
page: (_b = this.pageLabel) !== null && _b !== undefined ? _b : this.id,
|
|
1255
1255
|
});
|
|
1256
1256
|
}
|
|
1257
1257
|
get _thumbPageCanvas() {
|
|
1258
1258
|
var _b;
|
|
1259
1259
|
return this.l10n.get("thumb_page_canvas", {
|
|
1260
|
-
page: ((_b = this.pageLabel) !== null && _b !==
|
|
1260
|
+
page: ((_b = this.pageLabel) !== null && _b !== undefined ? _b : this.id),
|
|
1261
1261
|
});
|
|
1262
1262
|
}
|
|
1263
1263
|
/**
|
|
@@ -1377,7 +1377,7 @@ class PDFThumbnailViewer {
|
|
|
1377
1377
|
// If the thumbnail isn't currently visible, scroll it into view.
|
|
1378
1378
|
if (views.length > 0) {
|
|
1379
1379
|
let shouldScroll = false;
|
|
1380
|
-
if (pageNumber <= first.id || pageNumber >= (last === null || last ===
|
|
1380
|
+
if (pageNumber <= first.id || pageNumber >= (last === null || last === undefined ? undefined : last.id)) {
|
|
1381
1381
|
shouldScroll = true;
|
|
1382
1382
|
}
|
|
1383
1383
|
else {
|
|
@@ -1472,7 +1472,7 @@ class PDFThumbnailViewer {
|
|
|
1472
1472
|
// Set the first `pdfPage` immediately, since it's already loaded,
|
|
1473
1473
|
// rather than having to repeat the `PDFDocumentProxy.getPage` call in
|
|
1474
1474
|
// the `this.#ensurePdfPageLoaded` method before rendering can start.
|
|
1475
|
-
(_a = this._thumbnails[0]) === null || _a ===
|
|
1475
|
+
(_a = this._thumbnails[0]) === null || _a === undefined ? undefined : _a.setPdfPage(firstPdfPage);
|
|
1476
1476
|
// Ensure that the current thumbnail is always highlighted on load.
|
|
1477
1477
|
const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
|
|
1478
1478
|
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
|
|
@@ -1510,7 +1510,7 @@ class PDFThumbnailViewer {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
// Update all the `PDFThumbnailView` instances.
|
|
1512
1512
|
for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
|
|
1513
|
-
this._thumbnails[i].setPageLabel((_b = (_a = this._pageLabels) === null || _a ===
|
|
1513
|
+
this._thumbnails[i].setPageLabel((_b = (_a = this._pageLabels) === null || _a === undefined ? undefined : _a[i]) !== null && _b !== undefined ? _b : null);
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
1516
|
forceRendering() {
|
|
@@ -1530,8 +1530,8 @@ class PDFThumbnailViewer {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
_PDFThumbnailViewer_instances = new WeakSet(), _PDFThumbnailViewer_ensurePdfPageLoaded = function _PDFThumbnailViewer_ensurePdfPageLoaded(thumbView) {
|
|
1532
1532
|
var _a;
|
|
1533
|
-
return __awaiter(this,
|
|
1534
|
-
if (thumbView === null || thumbView ===
|
|
1533
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
1534
|
+
if (thumbView === null || thumbView === undefined ? undefined : thumbView.pdfPage) {
|
|
1535
1535
|
return thumbView.pdfPage;
|
|
1536
1536
|
}
|
|
1537
1537
|
try {
|
|
@@ -1549,10 +1549,10 @@ _PDFThumbnailViewer_instances = new WeakSet(), _PDFThumbnailViewer_ensurePdfPage
|
|
|
1549
1549
|
}, _PDFThumbnailViewer_getScrollAhead = function _PDFThumbnailViewer_getScrollAhead(visible) {
|
|
1550
1550
|
var _a, _b;
|
|
1551
1551
|
// console.log(`visible: `, visible)
|
|
1552
|
-
if (((_a = visible.first) === null || _a ===
|
|
1552
|
+
if (((_a = visible.first) === null || _a === undefined ? undefined : _a.id) === 1) {
|
|
1553
1553
|
return true;
|
|
1554
1554
|
}
|
|
1555
|
-
else if (((_b = visible.last) === null || _b ===
|
|
1555
|
+
else if (((_b = visible.last) === null || _b === undefined ? undefined : _b.id) === this._thumbnails.length) {
|
|
1556
1556
|
return false;
|
|
1557
1557
|
}
|
|
1558
1558
|
return this.scroll.down;
|
|
@@ -1589,7 +1589,7 @@ class OverlayManager {
|
|
|
1589
1589
|
* registered.
|
|
1590
1590
|
*/
|
|
1591
1591
|
register(dialog, canForceClose = false) {
|
|
1592
|
-
return __awaiter(this,
|
|
1592
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
1593
1593
|
if (typeof dialog !== "object") {
|
|
1594
1594
|
throw new Error("Not enough parameters.");
|
|
1595
1595
|
}
|
|
@@ -1608,7 +1608,7 @@ class OverlayManager {
|
|
|
1608
1608
|
* unregistered.
|
|
1609
1609
|
*/
|
|
1610
1610
|
unregister(dialog) {
|
|
1611
|
-
return __awaiter(this,
|
|
1611
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
1612
1612
|
if (!__classPrivateFieldGet(this, _OverlayManager_overlays, "f").has(dialog)) {
|
|
1613
1613
|
throw new Error("The overlay does not exist.");
|
|
1614
1614
|
}
|
|
@@ -1624,7 +1624,7 @@ class OverlayManager {
|
|
|
1624
1624
|
* opened.
|
|
1625
1625
|
*/
|
|
1626
1626
|
open(dialog) {
|
|
1627
|
-
return __awaiter(this,
|
|
1627
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
1628
1628
|
if (!__classPrivateFieldGet(this, _OverlayManager_overlays, "f").has(dialog)) {
|
|
1629
1629
|
throw new Error("The overlay does not exist.");
|
|
1630
1630
|
}
|
|
@@ -1649,7 +1649,7 @@ class OverlayManager {
|
|
|
1649
1649
|
* closed.
|
|
1650
1650
|
*/
|
|
1651
1651
|
close(dialog = __classPrivateFieldGet(this, _OverlayManager_active, "f")) {
|
|
1652
|
-
return __awaiter(this,
|
|
1652
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
1653
1653
|
if (!dialog || !__classPrivateFieldGet(this, _OverlayManager_overlays, "f").has(dialog)) {
|
|
1654
1654
|
throw new Error("The overlay does not exist.");
|
|
1655
1655
|
}
|
|
@@ -1687,12 +1687,11 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
|
|
|
1687
1687
|
const xfaHtml = pdfDocument.allXfaHtml;
|
|
1688
1688
|
const linkService = new SimpleLinkService();
|
|
1689
1689
|
const scale = Math.round(PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;
|
|
1690
|
-
for (const xfaPage of xfaHtml === null || xfaHtml ===
|
|
1690
|
+
for (const xfaPage of xfaHtml === null || xfaHtml === undefined ? undefined : xfaHtml.children) {
|
|
1691
1691
|
const page = document.createElement("div");
|
|
1692
1692
|
page.className = "xfaPrintedPage";
|
|
1693
1693
|
printContainer.append(page);
|
|
1694
1694
|
const builder = new XfaLayerBuilder({
|
|
1695
|
-
pageDiv: page,
|
|
1696
1695
|
pdfPage: null,
|
|
1697
1696
|
annotationStorage: pdfDocument.annotationStorage,
|
|
1698
1697
|
linkService,
|
|
@@ -1700,6 +1699,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
|
|
|
1700
1699
|
});
|
|
1701
1700
|
const viewport = getXfaPageViewport(xfaPage, { scale });
|
|
1702
1701
|
builder.render(viewport, "print");
|
|
1702
|
+
page.append(builder.div);
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
1705
|
let activeService = null;
|
|
@@ -1752,7 +1752,7 @@ class PDFPrintService {
|
|
|
1752
1752
|
layout() {
|
|
1753
1753
|
this.throwIfInactive();
|
|
1754
1754
|
const body = document.querySelector("body");
|
|
1755
|
-
body === null || body ===
|
|
1755
|
+
body === null || body === undefined ? undefined : body.setAttribute("data-pdfjsprinting", "true");
|
|
1756
1756
|
const hasEqualPageSizes = this.pagesOverview.every((size) => {
|
|
1757
1757
|
return (size.width === this.pagesOverview[0].width &&
|
|
1758
1758
|
size.height === this.pagesOverview[0].height);
|
|
@@ -1774,7 +1774,7 @@ class PDFPrintService {
|
|
|
1774
1774
|
const pageSize = this.pagesOverview[0];
|
|
1775
1775
|
this.pageStyleSheet.textContent =
|
|
1776
1776
|
"@page { size: " + pageSize.width + "pt " + pageSize.height + "pt;}";
|
|
1777
|
-
body === null || body ===
|
|
1777
|
+
body === null || body === undefined ? undefined : body.append(this.pageStyleSheet);
|
|
1778
1778
|
}
|
|
1779
1779
|
destroy() {
|
|
1780
1780
|
if (activeService !== this) {
|
|
@@ -1784,7 +1784,7 @@ class PDFPrintService {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
this.printContainer.textContent = "";
|
|
1786
1786
|
const body = document.querySelector("body");
|
|
1787
|
-
body === null || body ===
|
|
1787
|
+
body === null || body === undefined ? undefined : body.removeAttribute("data-pdfjsprinting");
|
|
1788
1788
|
if (this.pageStyleSheet) {
|
|
1789
1789
|
this.pageStyleSheet.remove();
|
|
1790
1790
|
this.pageStyleSheet = null;
|
|
@@ -2038,7 +2038,7 @@ class PDFPresentationMode {
|
|
|
2038
2038
|
* @returns {Promise<boolean>} Indicating if the request was successful.
|
|
2039
2039
|
*/
|
|
2040
2040
|
request() {
|
|
2041
|
-
return __awaiter(this,
|
|
2041
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2042
2042
|
const { container, pdfViewer } = this;
|
|
2043
2043
|
if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {
|
|
2044
2044
|
return false;
|
|
@@ -2059,8 +2059,8 @@ class PDFPresentationMode {
|
|
|
2059
2059
|
"since the document may contain varying page sizes.");
|
|
2060
2060
|
__classPrivateFieldGet(this, _PDFPresentationMode_args, "f").spreadMode = pdfViewer.spreadMode;
|
|
2061
2061
|
}
|
|
2062
|
-
if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {
|
|
2063
|
-
__classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode = pdfViewer.annotationEditorMode;
|
|
2062
|
+
if (pdfViewer.annotationEditorMode.mode !== AnnotationEditorType.DISABLE) {
|
|
2063
|
+
__classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode = pdfViewer.annotationEditorMode.mode;
|
|
2064
2064
|
}
|
|
2065
2065
|
try {
|
|
2066
2066
|
yield promise;
|
|
@@ -2125,7 +2125,7 @@ _PDFPresentationMode_state = new WeakMap(), _PDFPresentationMode_args = new Weak
|
|
|
2125
2125
|
this.pdfViewer.currentPageNumber = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").pageNumber;
|
|
2126
2126
|
this.pdfViewer.currentScaleValue = "page-fit";
|
|
2127
2127
|
if (__classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode !== null) {
|
|
2128
|
-
this.pdfViewer.annotationEditorMode = AnnotationEditorType.NONE;
|
|
2128
|
+
this.pdfViewer.annotationEditorMode = { mode: AnnotationEditorType.NONE };
|
|
2129
2129
|
}
|
|
2130
2130
|
}, 0);
|
|
2131
2131
|
__classPrivateFieldGet(this, _PDFPresentationMode_instances, "m", _PDFPresentationMode_addWindowListeners).call(this);
|
|
@@ -2134,7 +2134,7 @@ _PDFPresentationMode_state = new WeakMap(), _PDFPresentationMode_args = new Weak
|
|
|
2134
2134
|
// Text selection is disabled in Presentation Mode, thus it's not possible
|
|
2135
2135
|
// for the user to deselect text that is selected (e.g. with "Select all")
|
|
2136
2136
|
// when entering Presentation Mode, hence we remove any active selection.
|
|
2137
|
-
(_a = window.getSelection()) === null || _a ===
|
|
2137
|
+
(_a = window.getSelection()) === null || _a === undefined ? undefined : _a.removeAllRanges();
|
|
2138
2138
|
}, _PDFPresentationMode_exit = function _PDFPresentationMode_exit() {
|
|
2139
2139
|
const pageNumber = this.pdfViewer.currentPageNumber;
|
|
2140
2140
|
this.container.classList.remove(ACTIVE_SELECTOR);
|
|
@@ -2145,13 +2145,13 @@ _PDFPresentationMode_state = new WeakMap(), _PDFPresentationMode_args = new Weak
|
|
|
2145
2145
|
__classPrivateFieldGet(this, _PDFPresentationMode_instances, "m", _PDFPresentationMode_removeFullscreenChangeListeners).call(this);
|
|
2146
2146
|
__classPrivateFieldGet(this, _PDFPresentationMode_instances, "m", _PDFPresentationMode_notifyStateChange).call(this, PresentationModeState.NORMAL);
|
|
2147
2147
|
this.pdfViewer.scrollMode = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").scrollMode;
|
|
2148
|
-
if (((_a = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f")) === null || _a ===
|
|
2148
|
+
if (((_a = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f")) === null || _a === undefined ? undefined : _a.spreadMode) !== null) {
|
|
2149
2149
|
this.pdfViewer.spreadMode = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").spreadMode;
|
|
2150
2150
|
}
|
|
2151
2151
|
this.pdfViewer.currentScaleValue = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").scaleValue;
|
|
2152
2152
|
this.pdfViewer.currentPageNumber = pageNumber;
|
|
2153
2153
|
if (__classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode !== null) {
|
|
2154
|
-
this.pdfViewer.annotationEditorMode = __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode;
|
|
2154
|
+
this.pdfViewer.annotationEditorMode = { mode: __classPrivateFieldGet(this, _PDFPresentationMode_args, "f").annotationEditorMode };
|
|
2155
2155
|
}
|
|
2156
2156
|
__classPrivateFieldSet(this, _PDFPresentationMode_args, null, "f");
|
|
2157
2157
|
}, 0);
|
|
@@ -2172,7 +2172,7 @@ _PDFPresentationMode_state = new WeakMap(), _PDFPresentationMode_args = new Weak
|
|
|
2172
2172
|
// Enable clicking of links in presentation mode. Note: only links
|
|
2173
2173
|
// pointing to destinations in the current PDF document work.
|
|
2174
2174
|
if (evt.target.href &&
|
|
2175
|
-
((_a = evt.target.parentNode) === null || _a ===
|
|
2175
|
+
((_a = evt.target.parentNode) === null || _a === undefined ? undefined : _a.hasAttribute("data-internal-link"))) {
|
|
2176
2176
|
return;
|
|
2177
2177
|
}
|
|
2178
2178
|
// Unless an internal link was clicked, advance one page.
|
|
@@ -2365,7 +2365,7 @@ const create = () => createStore((set, get) => (Object.assign(Object.assign({},
|
|
|
2365
2365
|
} })));
|
|
2366
2366
|
|
|
2367
2367
|
var _PDFSlick_instances, _PDFSlick_renderingQueue, _PDFSlick_container, _PDFSlick_viewerContainer, _PDFSlick_thumbsContainer, _PDFSlick_annotationMode, _PDFSlick_annotationEditorMode, _PDFSlick_onError, _PDFSlick_initializePageLabels, _PDFSlick_parseDocumentInfo, _PDFSlick_parsePageSize, _PDFSlick_initInternalEventListeners, _PDFSlick_onDocumentReady, _PDFSlick_onRotationChanging, _PDFSlick_onSwitchSpreadMode, _PDFSlick_onSwitchScrollMode, _PDFSlick_onScaleChanging, _PDFSlick_onPageChanging, _PDFSlick_onPageRendered;
|
|
2368
|
-
GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.
|
|
2368
|
+
GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
2369
2369
|
const US_PAGE_NAMES = {
|
|
2370
2370
|
"8.5x11": "Letter",
|
|
2371
2371
|
"8.5x14": "Legal",
|
|
@@ -2381,37 +2381,38 @@ function getPageName(size, isPortrait, pageNames) {
|
|
|
2381
2381
|
}
|
|
2382
2382
|
class PDFSlick {
|
|
2383
2383
|
constructor({ container, viewer, thumbs, store = create(), options, onError }) {
|
|
2384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
2384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
2385
2385
|
_PDFSlick_instances.add(this);
|
|
2386
|
-
_PDFSlick_renderingQueue.set(this,
|
|
2387
|
-
_PDFSlick_container.set(this,
|
|
2388
|
-
_PDFSlick_viewerContainer.set(this,
|
|
2389
|
-
_PDFSlick_thumbsContainer.set(this,
|
|
2386
|
+
_PDFSlick_renderingQueue.set(this, undefined);
|
|
2387
|
+
_PDFSlick_container.set(this, undefined);
|
|
2388
|
+
_PDFSlick_viewerContainer.set(this, undefined);
|
|
2389
|
+
_PDFSlick_thumbsContainer.set(this, undefined);
|
|
2390
2390
|
this.downloadManager = null;
|
|
2391
2391
|
this.findController = null;
|
|
2392
2392
|
this.pdfPresentationMode = null;
|
|
2393
2393
|
this.document = null;
|
|
2394
2394
|
// options
|
|
2395
|
-
_PDFSlick_annotationMode.set(this,
|
|
2396
|
-
_PDFSlick_annotationEditorMode.set(this,
|
|
2397
|
-
_PDFSlick_onError.set(this,
|
|
2395
|
+
_PDFSlick_annotationMode.set(this, undefined);
|
|
2396
|
+
_PDFSlick_annotationEditorMode.set(this, undefined);
|
|
2397
|
+
_PDFSlick_onError.set(this, undefined);
|
|
2398
2398
|
__classPrivateFieldSet(this, _PDFSlick_container, container, "f");
|
|
2399
2399
|
__classPrivateFieldSet(this, _PDFSlick_viewerContainer, viewer, "f");
|
|
2400
2400
|
__classPrivateFieldSet(this, _PDFSlick_thumbsContainer, thumbs, "f");
|
|
2401
2401
|
__classPrivateFieldSet(this, _PDFSlick_onError, onError, "f");
|
|
2402
|
-
this.l10n = (_a = options === null || options ===
|
|
2402
|
+
this.l10n = (_a = options === null || options === undefined ? undefined : options.l10n) !== null && _a !== undefined ? _a : new GenericL10n(navigator.language);
|
|
2403
2403
|
this.downloadManager = new DownloadManager();
|
|
2404
|
-
this.textLayerMode = (_b = options === null || options ===
|
|
2405
|
-
__classPrivateFieldSet(this, _PDFSlick_annotationMode, (_c = options === null || options ===
|
|
2406
|
-
__classPrivateFieldSet(this, _PDFSlick_annotationEditorMode, (_d = options === null || options ===
|
|
2407
|
-
this.
|
|
2408
|
-
this.
|
|
2409
|
-
this.
|
|
2410
|
-
this.
|
|
2411
|
-
this.
|
|
2412
|
-
this.
|
|
2413
|
-
this.
|
|
2414
|
-
this.
|
|
2404
|
+
this.textLayerMode = (_b = options === null || options === undefined ? undefined : options.textLayerMode) !== null && _b !== undefined ? _b : TextLayerMode.ENABLE;
|
|
2405
|
+
__classPrivateFieldSet(this, _PDFSlick_annotationMode, (_c = options === null || options === undefined ? undefined : options.annotationMode) !== null && _c !== undefined ? _c : AnnotationMode.ENABLE_FORMS, "f");
|
|
2406
|
+
__classPrivateFieldSet(this, _PDFSlick_annotationEditorMode, (_d = options === null || options === undefined ? undefined : options.annotationEditorMode) !== null && _d !== undefined ? _d : AnnotationEditorType.NONE, "f");
|
|
2407
|
+
this.annotationEditorHighlightColors = (_e = options === null || options === undefined ? undefined : options.annotationEditorHighlightColors) !== null && _e !== undefined ? _e : "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F";
|
|
2408
|
+
this.removePageBorders = (_f = options === null || options === undefined ? undefined : options.removePageBorders) !== null && _f !== undefined ? _f : false;
|
|
2409
|
+
this.singlePageViewer = (_g = options === null || options === undefined ? undefined : options.singlePageViewer) !== null && _g !== undefined ? _g : false;
|
|
2410
|
+
this.enablePrintAutoRotate = (_h = options === null || options === undefined ? undefined : options.enablePrintAutoRotate) !== null && _h !== undefined ? _h : false;
|
|
2411
|
+
this.useOnlyCssZoom = (_j = options === null || options === undefined ? undefined : options.useOnlyCssZoom) !== null && _j !== undefined ? _j : false;
|
|
2412
|
+
this.pageColors = (_k = options === null || options === undefined ? undefined : options.pageColors) !== null && _k !== undefined ? _k : null;
|
|
2413
|
+
this.maxCanvasPixels = (_l = options === null || options === undefined ? undefined : options.maxCanvasPixels) !== null && _l !== undefined ? _l : 16777216;
|
|
2414
|
+
this.printResolution = (_m = options === null || options === undefined ? undefined : options.printResolution) !== null && _m !== undefined ? _m : 96;
|
|
2415
|
+
this.thumbnailWidth = (_o = options === null || options === undefined ? undefined : options.thumbnailWidth) !== null && _o !== undefined ? _o : 125;
|
|
2415
2416
|
if (this.pageColors &&
|
|
2416
2417
|
!(CSS.supports("color", this.pageColors.background) &&
|
|
2417
2418
|
CSS.supports("color", this.pageColors.foreground))) {
|
|
@@ -2420,7 +2421,6 @@ class PDFSlick {
|
|
|
2420
2421
|
}
|
|
2421
2422
|
this.pageColors = null;
|
|
2422
2423
|
}
|
|
2423
|
-
this.l10n = NullL10n;
|
|
2424
2424
|
this.store = store;
|
|
2425
2425
|
const renderingQueue = new PDFRenderingQueue();
|
|
2426
2426
|
renderingQueue.onIdle = this._cleanup.bind(this);
|
|
@@ -2435,7 +2435,7 @@ class PDFSlick {
|
|
|
2435
2435
|
});
|
|
2436
2436
|
const viewerOptions = Object.assign(Object.assign({ container }, (viewer && { viewer })), { eventBus,
|
|
2437
2437
|
linkService,
|
|
2438
|
-
renderingQueue,
|
|
2438
|
+
renderingQueue, textLayerMode: this.textLayerMode, annotationEditorHighlightColors: this.annotationEditorHighlightColors, l10n: this.l10n, annotationMode: __classPrivateFieldGet(this, _PDFSlick_annotationMode, "f"), annotationEditorMode: __classPrivateFieldGet(this, _PDFSlick_annotationEditorMode, "f"), removePageBorders: this.removePageBorders, imageResourcesPath: "/images/" });
|
|
2439
2439
|
const pdfViewer = this.singlePageViewer
|
|
2440
2440
|
? new PDFSinglePageViewer(viewerOptions)
|
|
2441
2441
|
: new PDFViewer(viewerOptions);
|
|
@@ -2464,12 +2464,12 @@ class PDFSlick {
|
|
|
2464
2464
|
this.linkService = linkService;
|
|
2465
2465
|
this.viewer = pdfViewer;
|
|
2466
2466
|
this.linkService.setViewer(pdfViewer);
|
|
2467
|
-
const scaleValue = (
|
|
2467
|
+
const scaleValue = (_p = options === null || options === undefined ? undefined : options.scaleValue) !== null && _p !== undefined ? _p : "auto";
|
|
2468
2468
|
this.store.setState({ scaleValue });
|
|
2469
2469
|
}
|
|
2470
2470
|
loadDocument(url, options) {
|
|
2471
2471
|
var _a, _b, _c, _d, _e;
|
|
2472
|
-
return __awaiter(this,
|
|
2472
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2473
2473
|
if (this.url && typeof this.url === "string") {
|
|
2474
2474
|
try {
|
|
2475
2475
|
URL.revokeObjectURL(this.url);
|
|
@@ -2533,31 +2533,31 @@ class PDFSlick {
|
|
|
2533
2533
|
gotoPage(pageNumber) {
|
|
2534
2534
|
this.linkService.goToPage(pageNumber);
|
|
2535
2535
|
}
|
|
2536
|
-
openOrDownloadData(
|
|
2536
|
+
openOrDownloadData(data, filename) {
|
|
2537
2537
|
var _a;
|
|
2538
|
-
(_a = this.downloadManager) === null || _a ===
|
|
2538
|
+
(_a = this.downloadManager) === null || _a === undefined ? undefined : _a.openOrDownloadData(data, filename);
|
|
2539
2539
|
}
|
|
2540
2540
|
download() {
|
|
2541
2541
|
var _a, _b;
|
|
2542
|
-
return __awaiter(this,
|
|
2542
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2543
2543
|
const url = this.url;
|
|
2544
2544
|
const { filename } = this;
|
|
2545
2545
|
try {
|
|
2546
2546
|
// this._ensureDownloadComplete();
|
|
2547
2547
|
const data = yield this.document.getData();
|
|
2548
2548
|
const blob = new Blob([data], { type: "application/pdf" });
|
|
2549
|
-
yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename
|
|
2549
|
+
yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename));
|
|
2550
2550
|
}
|
|
2551
2551
|
catch (reason) {
|
|
2552
2552
|
// When the PDF document isn't ready, or the PDF file is still
|
|
2553
2553
|
// downloading, simply download using the URL.
|
|
2554
|
-
yield ((_b = this.downloadManager) === null || _b ===
|
|
2554
|
+
yield ((_b = this.downloadManager) === null || _b === undefined ? undefined : _b.download(null, url, filename));
|
|
2555
2555
|
}
|
|
2556
2556
|
});
|
|
2557
2557
|
}
|
|
2558
2558
|
save() {
|
|
2559
2559
|
var _a;
|
|
2560
|
-
return __awaiter(this,
|
|
2560
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2561
2561
|
// if (this._saveInProgress) return;
|
|
2562
2562
|
// this._saveInProgress = true;
|
|
2563
2563
|
// await this.pdfScriptingManager.dispatchWillSave();
|
|
@@ -2567,7 +2567,7 @@ class PDFSlick {
|
|
|
2567
2567
|
// this._ensureDownloadComplete();
|
|
2568
2568
|
const data = yield this.document.saveDocument();
|
|
2569
2569
|
const blob = new Blob([data], { type: "application/pdf" });
|
|
2570
|
-
yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename
|
|
2570
|
+
yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename));
|
|
2571
2571
|
}
|
|
2572
2572
|
catch (reason) {
|
|
2573
2573
|
// When the PDF document isn't ready, or the PDF file is still
|
|
@@ -2583,7 +2583,7 @@ class PDFSlick {
|
|
|
2583
2583
|
}
|
|
2584
2584
|
downloadOrSave() {
|
|
2585
2585
|
var _a;
|
|
2586
|
-
const { annotationStorage } = (_a = this.document) !== null && _a !==
|
|
2586
|
+
const { annotationStorage } = (_a = this.document) !== null && _a !== undefined ? _a : {};
|
|
2587
2587
|
if (annotationStorage && annotationStorage.size > 0) {
|
|
2588
2588
|
this.save();
|
|
2589
2589
|
}
|
|
@@ -2618,7 +2618,7 @@ class PDFSlick {
|
|
|
2618
2618
|
// The beforePrint is a sync method and we need to know layout before
|
|
2619
2619
|
// returning from this method. Ensure that we can get sizes of the pages.
|
|
2620
2620
|
if (!this.viewer.pageViewsReady) {
|
|
2621
|
-
this.l10n.get("printing_not_ready").then((msg) => {
|
|
2621
|
+
this.l10n.get("printing_not_ready", null).then((msg) => {
|
|
2622
2622
|
// eslint-disable-next-line no-alert
|
|
2623
2623
|
window.alert(msg);
|
|
2624
2624
|
});
|
|
@@ -2653,7 +2653,7 @@ class PDFSlick {
|
|
|
2653
2653
|
if (this.printService) {
|
|
2654
2654
|
this.printService.destroy();
|
|
2655
2655
|
this.printService = null;
|
|
2656
|
-
(_a = this.document) === null || _a ===
|
|
2656
|
+
(_a = this.document) === null || _a === undefined ? undefined : _a.annotationStorage.resetModified();
|
|
2657
2657
|
}
|
|
2658
2658
|
this.forceRendering();
|
|
2659
2659
|
// Re-enable the editor-indicator after printing (fixes bug 1790552).
|
|
@@ -2661,7 +2661,7 @@ class PDFSlick {
|
|
|
2661
2661
|
}
|
|
2662
2662
|
requestPresentationMode() {
|
|
2663
2663
|
var _a;
|
|
2664
|
-
(_a = this.pdfPresentationMode) === null || _a ===
|
|
2664
|
+
(_a = this.pdfPresentationMode) === null || _a === undefined ? undefined : _a.request();
|
|
2665
2665
|
}
|
|
2666
2666
|
triggerPrinting() {
|
|
2667
2667
|
if (!this.supportsPrinting) {
|
|
@@ -2684,8 +2684,11 @@ class PDFSlick {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
setAnnotationEditorMode(annotationEditorMode) {
|
|
2687
|
-
// @ts-ignore: agr updated to { mode: number, editId: null } see: https://github.com/mozilla/pdf.js/commit/5c5f9af803187d616703c19987eca5d7d39d9420
|
|
2688
2687
|
this.viewer.annotationEditorMode = { mode: annotationEditorMode };
|
|
2688
|
+
this.dispatch("switchannotationeditormode", {
|
|
2689
|
+
source: this,
|
|
2690
|
+
mode: annotationEditorMode
|
|
2691
|
+
});
|
|
2689
2692
|
this.store.setState({ annotationEditorMode });
|
|
2690
2693
|
}
|
|
2691
2694
|
setAnnotationEditorParams(annotationEditorParams) {
|
|
@@ -2693,9 +2696,23 @@ class PDFSlick {
|
|
|
2693
2696
|
? annotationEditorParams
|
|
2694
2697
|
: [annotationEditorParams];
|
|
2695
2698
|
for (const params of pairs) {
|
|
2696
|
-
this.
|
|
2699
|
+
this.dispatch("switchannotationeditorparams", {
|
|
2700
|
+
source: this,
|
|
2701
|
+
type: params.type,
|
|
2702
|
+
value: params.value,
|
|
2703
|
+
});
|
|
2697
2704
|
}
|
|
2698
2705
|
}
|
|
2706
|
+
setHighlightDefaultColor(color) {
|
|
2707
|
+
this.setAnnotationEditorMode(AnnotationEditorType.HIGHLIGHT);
|
|
2708
|
+
this.setAnnotationEditorParams([
|
|
2709
|
+
{
|
|
2710
|
+
type: AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,
|
|
2711
|
+
value: color,
|
|
2712
|
+
},
|
|
2713
|
+
]);
|
|
2714
|
+
this.store.setState({ highlightDefaultColor: color });
|
|
2715
|
+
}
|
|
2699
2716
|
setSpreadMode(spread) {
|
|
2700
2717
|
if (isValidSpreadMode(spread)) {
|
|
2701
2718
|
this.viewer.spreadMode = spread;
|
|
@@ -2769,7 +2786,7 @@ class PDFSlick {
|
|
|
2769
2786
|
this.eventBus.off(eventName, listener, options);
|
|
2770
2787
|
}
|
|
2771
2788
|
/**
|
|
2772
|
-
* Dispatch event on
|
|
2789
|
+
* Dispatch event on the eventBus
|
|
2773
2790
|
* @param eventName TEventBusName
|
|
2774
2791
|
* @param data Object
|
|
2775
2792
|
*/
|
|
@@ -2779,9 +2796,9 @@ class PDFSlick {
|
|
|
2779
2796
|
}
|
|
2780
2797
|
_PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _PDFSlick_viewerContainer = new WeakMap(), _PDFSlick_thumbsContainer = new WeakMap(), _PDFSlick_annotationMode = new WeakMap(), _PDFSlick_annotationEditorMode = new WeakMap(), _PDFSlick_onError = new WeakMap(), _PDFSlick_instances = new WeakSet(), _PDFSlick_initializePageLabels = function _PDFSlick_initializePageLabels() {
|
|
2781
2798
|
var _a;
|
|
2782
|
-
return __awaiter(this,
|
|
2799
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2783
2800
|
const pdfDocument = this.document;
|
|
2784
|
-
const labels = (_a = (yield pdfDocument.getPageLabels())) !== null && _a !==
|
|
2801
|
+
const labels = (_a = (yield pdfDocument.getPageLabels())) !== null && _a !== undefined ? _a : [];
|
|
2785
2802
|
const numLabels = labels.length;
|
|
2786
2803
|
// Ignore page labels that correspond to standard page numbering,
|
|
2787
2804
|
// or page labels that are all empty.
|
|
@@ -2803,10 +2820,10 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2803
2820
|
}
|
|
2804
2821
|
const { viewer: pdfViewer, thumbnailViewer: pdfThumbnailViewer } = this;
|
|
2805
2822
|
pdfViewer.setPageLabels(labels);
|
|
2806
|
-
pdfThumbnailViewer === null || pdfThumbnailViewer ===
|
|
2823
|
+
pdfThumbnailViewer === null || pdfThumbnailViewer === undefined ? undefined : pdfThumbnailViewer.setPageLabels(labels);
|
|
2807
2824
|
});
|
|
2808
2825
|
}, _PDFSlick_parseDocumentInfo = function _PDFSlick_parseDocumentInfo() {
|
|
2809
|
-
return __awaiter(this,
|
|
2826
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2810
2827
|
const { info, contentLength } = (yield this.document.getMetadata());
|
|
2811
2828
|
const pageSize = yield this.document.getPage(this.store.getState().pageNumber).then((pdfPage) => {
|
|
2812
2829
|
return __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_parsePageSize).call(this, getPageSizeInches(pdfPage), 0);
|
|
@@ -2827,7 +2844,7 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2827
2844
|
});
|
|
2828
2845
|
});
|
|
2829
2846
|
}, _PDFSlick_parsePageSize = function _PDFSlick_parsePageSize(pageSizeInches, pagesRotation) {
|
|
2830
|
-
return __awaiter(this,
|
|
2847
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2831
2848
|
if (!pageSizeInches) {
|
|
2832
2849
|
return undefined;
|
|
2833
2850
|
}
|
|
@@ -2881,10 +2898,10 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2881
2898
|
}
|
|
2882
2899
|
const [{ width, height }, unit, name, orientation] = yield Promise.all([
|
|
2883
2900
|
sizeInches ,
|
|
2884
|
-
this.l10n.get(`document_properties_page_size_unit_${"inches" }
|
|
2901
|
+
this.l10n.get(`document_properties_page_size_unit_${"inches" }`, null),
|
|
2885
2902
|
rawName &&
|
|
2886
|
-
this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}
|
|
2887
|
-
this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}
|
|
2903
|
+
this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}`, null),
|
|
2904
|
+
this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}`, null),
|
|
2888
2905
|
]);
|
|
2889
2906
|
return {
|
|
2890
2907
|
width: width.toLocaleString(),
|
|
@@ -2912,8 +2929,8 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2912
2929
|
};
|
|
2913
2930
|
}, _PDFSlick_onDocumentReady = function _PDFSlick_onDocumentReady({ source }) {
|
|
2914
2931
|
var _a;
|
|
2915
|
-
return __awaiter(this,
|
|
2916
|
-
const documentOutline = (yield ((_a = this.document) === null || _a ===
|
|
2932
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2933
|
+
const documentOutline = (yield ((_a = this.document) === null || _a === undefined ? undefined : _a.getOutline()));
|
|
2917
2934
|
const scaleValue = this.store.getState().scaleValue;
|
|
2918
2935
|
// source._setScale(scaleValue, {}); // page-fit, page-actual, auto, page-width
|
|
2919
2936
|
source.currentScale = 1;
|
|
@@ -2942,14 +2959,14 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2942
2959
|
this.viewer.update();
|
|
2943
2960
|
}, _PDFSlick_onPageChanging = function _PDFSlick_onPageChanging({ pageNumber }) {
|
|
2944
2961
|
var _a;
|
|
2945
|
-
(_a = this.thumbnailViewer) === null || _a ===
|
|
2962
|
+
(_a = this.thumbnailViewer) === null || _a === undefined ? undefined : _a.scrollThumbnailIntoView(pageNumber);
|
|
2946
2963
|
this.store.setState({ pageNumber });
|
|
2947
2964
|
}, _PDFSlick_onPageRendered = function _PDFSlick_onPageRendered({ pageNumber, error }) {
|
|
2948
2965
|
var _a;
|
|
2949
2966
|
// Use the rendered page to set the corresponding thumbnail image.
|
|
2950
2967
|
if (__classPrivateFieldGet(this, _PDFSlick_thumbsContainer, "f")) {
|
|
2951
2968
|
const pageView = this.viewer.getPageView(pageNumber - 1);
|
|
2952
|
-
const thumbnailView = (_a = this.thumbnailViewer) === null || _a ===
|
|
2969
|
+
const thumbnailView = (_a = this.thumbnailViewer) === null || _a === undefined ? undefined : _a.getThumbnail(pageNumber - 1);
|
|
2953
2970
|
if (pageView && thumbnailView) {
|
|
2954
2971
|
thumbnailView.setImage(pageView);
|
|
2955
2972
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf_presentation_mode.d.ts","sourceRoot":"","sources":["../../lib/pdf_presentation_mode.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pdf_presentation_mode.d.ts","sourceRoot":"","sources":["../../lib/pdf_presentation_mode.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAepE;;;;;GAKG;AAEH,cAAM,mBAAmB;;IACvB,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IAEnB,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,IAAI,GAAG;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAEhD,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,yBAAyB,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,oBAAoB,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAYxC;;OAEG;gBACS,EACV,SAAS,EACT,SAAS,EACT,QAAQ,GACT,EAAE;QACD,SAAS,EAAE,cAAc,CAAC;QAC1B,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,QAAQ,CAAC;KACpB;IAWD;;;OAGG;IACG,OAAO;IA4Cb,IAAI,MAAM,YAKT;CAyRF;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PDFDocumentProxy } from "pdfjs-dist";
|
|
2
|
-
import {
|
|
2
|
+
import { IL10n } from "pdfjs-dist/types/web/pdf_viewer";
|
|
3
3
|
declare class PDFPrintService {
|
|
4
4
|
pdfDocument: PDFDocumentProxy;
|
|
5
5
|
pagesOverview: any;
|
|
@@ -7,11 +7,11 @@ declare class PDFPrintService {
|
|
|
7
7
|
_printResolution: number;
|
|
8
8
|
_optionalContentConfigPromise: any;
|
|
9
9
|
_printAnnotationStoragePromise: any;
|
|
10
|
-
l10n:
|
|
10
|
+
l10n: IL10n;
|
|
11
11
|
currentPage: number;
|
|
12
12
|
scratchCanvas: HTMLCanvasElement | null;
|
|
13
13
|
pageStyleSheet: HTMLStyleElement | null;
|
|
14
|
-
constructor(pdfDocument: PDFDocumentProxy, pagesOverview: any, printContainer: HTMLElement, printResolution: number, optionalContentConfigPromise: null | undefined, printAnnotationStoragePromise: null | undefined, l10n:
|
|
14
|
+
constructor(pdfDocument: PDFDocumentProxy, pagesOverview: any, printContainer: HTMLElement, printResolution: number, optionalContentConfigPromise: null | undefined, printAnnotationStoragePromise: null | undefined, l10n: IL10n);
|
|
15
15
|
layout(): void;
|
|
16
16
|
destroy(): void;
|
|
17
17
|
renderPages(): Promise<unknown>;
|