@pdfslick/core 2.0.0 → 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/index.js +70 -70
- package/dist/pdf_viewer.css +4 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +8 -7
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RenderingCancelledException, PixelsPerInch, getXfaPageViewport, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions,
|
|
1
|
+
import { RenderingCancelledException, PixelsPerInch, getXfaPageViewport, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions, getPdfFilenameFromUrl, getDocument, AnnotationEditorParamsType, PDFDateString } from 'pdfjs-dist';
|
|
2
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
|
|
|
@@ -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,7 +1687,7 @@ 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);
|
|
@@ -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;
|
|
@@ -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,7 +2145,7 @@ _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;
|
|
@@ -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.
|
|
@@ -2383,36 +2383,36 @@ class PDFSlick {
|
|
|
2383
2383
|
constructor({ container, viewer, thumbs, store = create(), options, onError }) {
|
|
2384
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.annotationEditorHighlightColors = (_e = options === null || options ===
|
|
2408
|
-
this.removePageBorders = (_f = options === null || options ===
|
|
2409
|
-
this.singlePageViewer = (_g = options === null || options ===
|
|
2410
|
-
this.enablePrintAutoRotate = (_h = options === null || options ===
|
|
2411
|
-
this.useOnlyCssZoom = (_j = options === null || options ===
|
|
2412
|
-
this.pageColors = (_k = options === null || options ===
|
|
2413
|
-
this.maxCanvasPixels = (_l = options === null || options ===
|
|
2414
|
-
this.printResolution = (_m = options === null || options ===
|
|
2415
|
-
this.thumbnailWidth = (_o = options === null || options ===
|
|
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;
|
|
2416
2416
|
if (this.pageColors &&
|
|
2417
2417
|
!(CSS.supports("color", this.pageColors.background) &&
|
|
2418
2418
|
CSS.supports("color", this.pageColors.foreground))) {
|
|
@@ -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 = (_p = options === null || options ===
|
|
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);
|
|
@@ -2535,11 +2535,11 @@ class PDFSlick {
|
|
|
2535
2535
|
}
|
|
2536
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 {
|
|
@@ -2551,13 +2551,13 @@ class PDFSlick {
|
|
|
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();
|
|
@@ -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
|
}
|
|
@@ -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) {
|
|
@@ -2796,9 +2796,9 @@ class PDFSlick {
|
|
|
2796
2796
|
}
|
|
2797
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() {
|
|
2798
2798
|
var _a;
|
|
2799
|
-
return __awaiter(this,
|
|
2799
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2800
2800
|
const pdfDocument = this.document;
|
|
2801
|
-
const labels = (_a = (yield pdfDocument.getPageLabels())) !== null && _a !==
|
|
2801
|
+
const labels = (_a = (yield pdfDocument.getPageLabels())) !== null && _a !== undefined ? _a : [];
|
|
2802
2802
|
const numLabels = labels.length;
|
|
2803
2803
|
// Ignore page labels that correspond to standard page numbering,
|
|
2804
2804
|
// or page labels that are all empty.
|
|
@@ -2820,10 +2820,10 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2820
2820
|
}
|
|
2821
2821
|
const { viewer: pdfViewer, thumbnailViewer: pdfThumbnailViewer } = this;
|
|
2822
2822
|
pdfViewer.setPageLabels(labels);
|
|
2823
|
-
pdfThumbnailViewer === null || pdfThumbnailViewer ===
|
|
2823
|
+
pdfThumbnailViewer === null || pdfThumbnailViewer === undefined ? undefined : pdfThumbnailViewer.setPageLabels(labels);
|
|
2824
2824
|
});
|
|
2825
2825
|
}, _PDFSlick_parseDocumentInfo = function _PDFSlick_parseDocumentInfo() {
|
|
2826
|
-
return __awaiter(this,
|
|
2826
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2827
2827
|
const { info, contentLength } = (yield this.document.getMetadata());
|
|
2828
2828
|
const pageSize = yield this.document.getPage(this.store.getState().pageNumber).then((pdfPage) => {
|
|
2829
2829
|
return __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_parsePageSize).call(this, getPageSizeInches(pdfPage), 0);
|
|
@@ -2844,7 +2844,7 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2844
2844
|
});
|
|
2845
2845
|
});
|
|
2846
2846
|
}, _PDFSlick_parsePageSize = function _PDFSlick_parsePageSize(pageSizeInches, pagesRotation) {
|
|
2847
|
-
return __awaiter(this,
|
|
2847
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
2848
2848
|
if (!pageSizeInches) {
|
|
2849
2849
|
return undefined;
|
|
2850
2850
|
}
|
|
@@ -2929,8 +2929,8 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2929
2929
|
};
|
|
2930
2930
|
}, _PDFSlick_onDocumentReady = function _PDFSlick_onDocumentReady({ source }) {
|
|
2931
2931
|
var _a;
|
|
2932
|
-
return __awaiter(this,
|
|
2933
|
-
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()));
|
|
2934
2934
|
const scaleValue = this.store.getState().scaleValue;
|
|
2935
2935
|
// source._setScale(scaleValue, {}); // page-fit, page-actual, auto, page-width
|
|
2936
2936
|
source.currentScale = 1;
|
|
@@ -2959,14 +2959,14 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
|
|
|
2959
2959
|
this.viewer.update();
|
|
2960
2960
|
}, _PDFSlick_onPageChanging = function _PDFSlick_onPageChanging({ pageNumber }) {
|
|
2961
2961
|
var _a;
|
|
2962
|
-
(_a = this.thumbnailViewer) === null || _a ===
|
|
2962
|
+
(_a = this.thumbnailViewer) === null || _a === undefined ? undefined : _a.scrollThumbnailIntoView(pageNumber);
|
|
2963
2963
|
this.store.setState({ pageNumber });
|
|
2964
2964
|
}, _PDFSlick_onPageRendered = function _PDFSlick_onPageRendered({ pageNumber, error }) {
|
|
2965
2965
|
var _a;
|
|
2966
2966
|
// Use the rendered page to set the corresponding thumbnail image.
|
|
2967
2967
|
if (__classPrivateFieldGet(this, _PDFSlick_thumbsContainer, "f")) {
|
|
2968
2968
|
const pageView = this.viewer.getPageView(pageNumber - 1);
|
|
2969
|
-
const thumbnailView = (_a = this.thumbnailViewer) === null || _a ===
|
|
2969
|
+
const thumbnailView = (_a = this.thumbnailViewer) === null || _a === undefined ? undefined : _a.getThumbnail(pageNumber - 1);
|
|
2970
2970
|
if (pageView && thumbnailView) {
|
|
2971
2971
|
thumbnailView.setImage(pageView);
|
|
2972
2972
|
}
|
package/dist/pdf_viewer.css
CHANGED
|
@@ -1829,7 +1829,6 @@
|
|
|
1829
1829
|
|
|
1830
1830
|
.annotationEditorLayer.inkEditing{
|
|
1831
1831
|
cursor:var(--editorInk-editing-cursor);
|
|
1832
|
-
touch-action:none;
|
|
1833
1832
|
}
|
|
1834
1833
|
|
|
1835
1834
|
.annotationEditorLayer .draw{
|
|
@@ -3150,21 +3149,16 @@
|
|
|
3150
3149
|
}
|
|
3151
3150
|
|
|
3152
3151
|
:is(.pdfViewer .canvasWrapper) canvas{
|
|
3152
|
+
position:absolute;
|
|
3153
|
+
top:0;
|
|
3154
|
+
left:0;
|
|
3153
3155
|
margin:0;
|
|
3154
3156
|
display:block;
|
|
3155
3157
|
width:100%;
|
|
3156
3158
|
height:100%;
|
|
3159
|
+
contain:content;
|
|
3157
3160
|
}
|
|
3158
3161
|
|
|
3159
|
-
[hidden]:is(:is(.pdfViewer .canvasWrapper) canvas){
|
|
3160
|
-
display:none;
|
|
3161
|
-
}
|
|
3162
|
-
|
|
3163
|
-
[zooming]:is(:is(.pdfViewer .canvasWrapper) canvas){
|
|
3164
|
-
width:100%;
|
|
3165
|
-
height:100%;
|
|
3166
|
-
}
|
|
3167
|
-
|
|
3168
3162
|
:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{
|
|
3169
3163
|
contain:strict;
|
|
3170
3164
|
}
|