@progress/kendo-pdfviewer-common 0.5.0-develop.3 → 0.5.0-develop.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/widget/page.js
CHANGED
|
@@ -163,10 +163,9 @@ export class Page extends Component {
|
|
|
163
163
|
const canvas = this.canvasForPrint;
|
|
164
164
|
const printContentLoadPromise = this.createPromise();
|
|
165
165
|
const printContent = new Image();
|
|
166
|
-
const printUnits = this.pdfViewer.getPrintUnits();
|
|
167
166
|
const viewportRawDimensions = this.viewport.rawDims;
|
|
168
|
-
const pageHeight = Math.floor(viewportRawDimensions.pageHeight
|
|
169
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth
|
|
167
|
+
const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
|
|
168
|
+
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
170
169
|
printContent.src = canvas.toDataURL();
|
|
171
170
|
printContent.width = pageWidth;
|
|
172
171
|
printContent.height = pageHeight;
|
|
@@ -61,7 +61,8 @@ export class PdfViewer extends Component {
|
|
|
61
61
|
pageWheelThrottleDelay: 200,
|
|
62
62
|
// ported from pdf.js
|
|
63
63
|
printResolution: 100,
|
|
64
|
-
|
|
64
|
+
// the render scale that is used for controlling the render quality
|
|
65
|
+
renderScale: 3,
|
|
65
66
|
loadOnDemand: false,
|
|
66
67
|
loadOnDemandPageSize: 2,
|
|
67
68
|
messages: {
|
|
@@ -254,6 +255,7 @@ export class PdfViewer extends Component {
|
|
|
254
255
|
destroy() {
|
|
255
256
|
this.destroyEventBus();
|
|
256
257
|
this.unbindEvents();
|
|
258
|
+
this.clearDocument();
|
|
257
259
|
this.destroySearchService();
|
|
258
260
|
this.destroyAnnotationEditorUIManager();
|
|
259
261
|
this.destroyDocumentScroller();
|
|
@@ -430,6 +432,7 @@ export class PdfViewer extends Component {
|
|
|
430
432
|
destroyAnnotationEditorUIManager() {
|
|
431
433
|
var _a;
|
|
432
434
|
(_a = this.annotationEditorUIManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
435
|
+
this.annotationEditorUIManager = null;
|
|
433
436
|
}
|
|
434
437
|
bindEventBusAnnotationsEvents() {
|
|
435
438
|
const eventBus = this.eventBus = this.eventBus || new EventBus();
|
|
@@ -749,22 +752,21 @@ export class PdfViewer extends Component {
|
|
|
749
752
|
if (zoom <= 0) {
|
|
750
753
|
return;
|
|
751
754
|
}
|
|
752
|
-
|
|
753
|
-
let scaleNum = zoom * renderScale;
|
|
755
|
+
let scaleNum = this.options.renderScale * getDevicePixelRatio();
|
|
754
756
|
if (printUnits) {
|
|
755
|
-
scaleNum = zoom ||
|
|
757
|
+
scaleNum = zoom || scaleNum;
|
|
756
758
|
}
|
|
757
759
|
// changing the viewport dimensions here requires changes in
|
|
758
760
|
// page.getPrintContentAsync for the printing dimensions
|
|
759
761
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
760
762
|
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
761
|
-
// use PageView.setLayerDimensions
|
|
762
|
-
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
763
763
|
const styles = {
|
|
764
764
|
// "round" is supported in all browsers since May 2024
|
|
765
765
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/round#browser_compatibility
|
|
766
|
-
width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
767
|
-
height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
766
|
+
// width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
767
|
+
// height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
768
|
+
width: `round(var(--scale-factor) * ${viewport.width / scaleNum}px, 1px)`,
|
|
769
|
+
height: `round(var(--scale-factor) * ${viewport.height / scaleNum}px, 1px)`
|
|
768
770
|
};
|
|
769
771
|
const pageElement = createElement("div", "k-page", styles);
|
|
770
772
|
const canvas = createElement("canvas", '', {
|
|
@@ -163,10 +163,9 @@ export class Page extends Component {
|
|
|
163
163
|
const canvas = this.canvasForPrint;
|
|
164
164
|
const printContentLoadPromise = this.createPromise();
|
|
165
165
|
const printContent = new Image();
|
|
166
|
-
const printUnits = this.pdfViewer.getPrintUnits();
|
|
167
166
|
const viewportRawDimensions = this.viewport.rawDims;
|
|
168
|
-
const pageHeight = Math.floor(viewportRawDimensions.pageHeight
|
|
169
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth
|
|
167
|
+
const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
|
|
168
|
+
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
170
169
|
printContent.src = canvas.toDataURL();
|
|
171
170
|
printContent.width = pageWidth;
|
|
172
171
|
printContent.height = pageHeight;
|
|
@@ -61,7 +61,8 @@ export class PdfViewer extends Component {
|
|
|
61
61
|
pageWheelThrottleDelay: 200,
|
|
62
62
|
// ported from pdf.js
|
|
63
63
|
printResolution: 100,
|
|
64
|
-
|
|
64
|
+
// the render scale that is used for controlling the render quality
|
|
65
|
+
renderScale: 3,
|
|
65
66
|
loadOnDemand: false,
|
|
66
67
|
loadOnDemandPageSize: 2,
|
|
67
68
|
messages: {
|
|
@@ -254,6 +255,7 @@ export class PdfViewer extends Component {
|
|
|
254
255
|
destroy() {
|
|
255
256
|
this.destroyEventBus();
|
|
256
257
|
this.unbindEvents();
|
|
258
|
+
this.clearDocument();
|
|
257
259
|
this.destroySearchService();
|
|
258
260
|
this.destroyAnnotationEditorUIManager();
|
|
259
261
|
this.destroyDocumentScroller();
|
|
@@ -430,6 +432,7 @@ export class PdfViewer extends Component {
|
|
|
430
432
|
destroyAnnotationEditorUIManager() {
|
|
431
433
|
var _a;
|
|
432
434
|
(_a = this.annotationEditorUIManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
435
|
+
this.annotationEditorUIManager = null;
|
|
433
436
|
}
|
|
434
437
|
bindEventBusAnnotationsEvents() {
|
|
435
438
|
const eventBus = this.eventBus = this.eventBus || new EventBus();
|
|
@@ -749,22 +752,21 @@ export class PdfViewer extends Component {
|
|
|
749
752
|
if (zoom <= 0) {
|
|
750
753
|
return;
|
|
751
754
|
}
|
|
752
|
-
|
|
753
|
-
let scaleNum = zoom * renderScale;
|
|
755
|
+
let scaleNum = this.options.renderScale * getDevicePixelRatio();
|
|
754
756
|
if (printUnits) {
|
|
755
|
-
scaleNum = zoom ||
|
|
757
|
+
scaleNum = zoom || scaleNum;
|
|
756
758
|
}
|
|
757
759
|
// changing the viewport dimensions here requires changes in
|
|
758
760
|
// page.getPrintContentAsync for the printing dimensions
|
|
759
761
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
760
762
|
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
761
|
-
// use PageView.setLayerDimensions
|
|
762
|
-
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
763
763
|
const styles = {
|
|
764
764
|
// "round" is supported in all browsers since May 2024
|
|
765
765
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/round#browser_compatibility
|
|
766
|
-
width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
767
|
-
height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
766
|
+
// width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
767
|
+
// height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
768
|
+
width: `round(var(--scale-factor) * ${viewport.width / scaleNum}px, 1px)`,
|
|
769
|
+
height: `round(var(--scale-factor) * ${viewport.height / scaleNum}px, 1px)`
|
|
768
770
|
};
|
|
769
771
|
const pageElement = createElement("div", "k-page", styles);
|
|
770
772
|
const canvas = createElement("canvas", '', {
|
package/dist/npm/widget/page.js
CHANGED
|
@@ -163,10 +163,9 @@ class Page extends component_1.Component {
|
|
|
163
163
|
const canvas = this.canvasForPrint;
|
|
164
164
|
const printContentLoadPromise = this.createPromise();
|
|
165
165
|
const printContent = new Image();
|
|
166
|
-
const printUnits = this.pdfViewer.getPrintUnits();
|
|
167
166
|
const viewportRawDimensions = this.viewport.rawDims;
|
|
168
|
-
const pageHeight = Math.floor(viewportRawDimensions.pageHeight
|
|
169
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth
|
|
167
|
+
const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
|
|
168
|
+
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
170
169
|
printContent.src = canvas.toDataURL();
|
|
171
170
|
printContent.width = pageWidth;
|
|
172
171
|
printContent.height = pageHeight;
|
|
@@ -64,7 +64,8 @@ class PdfViewer extends main_1.Component {
|
|
|
64
64
|
pageWheelThrottleDelay: 200,
|
|
65
65
|
// ported from pdf.js
|
|
66
66
|
printResolution: 100,
|
|
67
|
-
|
|
67
|
+
// the render scale that is used for controlling the render quality
|
|
68
|
+
renderScale: 3,
|
|
68
69
|
loadOnDemand: false,
|
|
69
70
|
loadOnDemandPageSize: 2,
|
|
70
71
|
messages: {
|
|
@@ -257,6 +258,7 @@ class PdfViewer extends main_1.Component {
|
|
|
257
258
|
destroy() {
|
|
258
259
|
this.destroyEventBus();
|
|
259
260
|
this.unbindEvents();
|
|
261
|
+
this.clearDocument();
|
|
260
262
|
this.destroySearchService();
|
|
261
263
|
this.destroyAnnotationEditorUIManager();
|
|
262
264
|
this.destroyDocumentScroller();
|
|
@@ -433,6 +435,7 @@ class PdfViewer extends main_1.Component {
|
|
|
433
435
|
destroyAnnotationEditorUIManager() {
|
|
434
436
|
var _a;
|
|
435
437
|
(_a = this.annotationEditorUIManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
438
|
+
this.annotationEditorUIManager = null;
|
|
436
439
|
}
|
|
437
440
|
bindEventBusAnnotationsEvents() {
|
|
438
441
|
const eventBus = this.eventBus = this.eventBus || new event_utils_1.EventBus();
|
|
@@ -752,22 +755,21 @@ class PdfViewer extends main_1.Component {
|
|
|
752
755
|
if (zoom <= 0) {
|
|
753
756
|
return;
|
|
754
757
|
}
|
|
755
|
-
|
|
756
|
-
let scaleNum = zoom * renderScale;
|
|
758
|
+
let scaleNum = this.options.renderScale * (0, utils_1.getDevicePixelRatio)();
|
|
757
759
|
if (printUnits) {
|
|
758
|
-
scaleNum = zoom ||
|
|
760
|
+
scaleNum = zoom || scaleNum;
|
|
759
761
|
}
|
|
760
762
|
// changing the viewport dimensions here requires changes in
|
|
761
763
|
// page.getPrintContentAsync for the printing dimensions
|
|
762
764
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
763
765
|
const { adjustedWidth, adjustedHeight, adjustRatio } = (0, utils_1.adjustCanvasSize)(viewport.width, viewport.height);
|
|
764
|
-
// use PageView.setLayerDimensions
|
|
765
|
-
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
766
766
|
const styles = {
|
|
767
767
|
// "round" is supported in all browsers since May 2024
|
|
768
768
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/round#browser_compatibility
|
|
769
|
-
width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
770
|
-
height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
769
|
+
// width: `round(var(--scale-factor) * ${pageWidth}px, 1px)`,
|
|
770
|
+
// height: `round(var(--scale-factor) * ${pageHeight}px, 1px)`
|
|
771
|
+
width: `round(var(--scale-factor) * ${viewport.width / scaleNum}px, 1px)`,
|
|
772
|
+
height: `round(var(--scale-factor) * ${viewport.height / scaleNum}px, 1px)`
|
|
771
773
|
};
|
|
772
774
|
const pageElement = (0, utils_1.createElement)("div", "k-page", styles);
|
|
773
775
|
const canvas = (0, utils_1.createElement)("canvas", '', {
|
package/package.json
CHANGED