@progress/kendo-pdfviewer-common 0.5.0 → 0.5.1-develop.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/es/widget/page.js +6 -7
- package/dist/es/widget/pdfviewer.js +9 -0
- package/dist/es2015/widget/page.js +6 -7
- package/dist/es2015/widget/pdfviewer.js +9 -0
- package/dist/npm/widget/page.js +6 -7
- package/dist/npm/widget/pdfviewer.d.ts +3 -0
- package/dist/npm/widget/pdfviewer.js +9 -0
- package/package.json +1 -1
package/dist/es/widget/page.js
CHANGED
|
@@ -163,9 +163,8 @@ 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
|
|
167
|
-
const
|
|
168
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
166
|
+
const pageHeight = canvas.height;
|
|
167
|
+
const pageWidth = canvas.width;
|
|
169
168
|
printContent.src = canvas.toDataURL();
|
|
170
169
|
printContent.width = pageWidth;
|
|
171
170
|
printContent.height = pageHeight;
|
|
@@ -211,14 +210,14 @@ export class Page extends Component {
|
|
|
211
210
|
renderForPrintAsync() {
|
|
212
211
|
var _a, _b;
|
|
213
212
|
const printUnits = this.pdfViewer.getPrintUnits();
|
|
213
|
+
// this is how pdf.js prints
|
|
214
|
+
const printScale = 1;
|
|
214
215
|
const { canvasContext, canvas } = this.pdfViewer.createPageElements({
|
|
215
216
|
pdfPage: this.pdfPage,
|
|
216
|
-
zoom:
|
|
217
|
+
zoom: printScale,
|
|
217
218
|
printUnits
|
|
218
219
|
});
|
|
219
220
|
this.canvasForPrint = canvas;
|
|
220
|
-
// canvasWrapper.appendChild(canvas);
|
|
221
|
-
// pageElement.appendChild(canvasWrapper);
|
|
222
221
|
this.setState({
|
|
223
222
|
isPrintingInProgress: true
|
|
224
223
|
});
|
|
@@ -228,7 +227,7 @@ export class Page extends Component {
|
|
|
228
227
|
const renderContext = {
|
|
229
228
|
canvasContext: canvasContext,
|
|
230
229
|
transform: [printUnits, 0, 0, printUnits, 0, 0],
|
|
231
|
-
viewport: this.pdfPage.getViewport({ scale:
|
|
230
|
+
viewport: this.pdfPage.getViewport({ scale: printScale, rotation: this.viewport.rotation }),
|
|
232
231
|
intent: "print",
|
|
233
232
|
annotationMode: AnnotationMode.ENABLE_STORAGE,
|
|
234
233
|
optionalContentConfigPromise,
|
|
@@ -1408,6 +1408,15 @@ export class PdfViewer extends Component {
|
|
|
1408
1408
|
setAnnotationEditorMode(modeDescriptor) {
|
|
1409
1409
|
this.annotationEditorMode = modeDescriptor;
|
|
1410
1410
|
}
|
|
1411
|
+
setAnnotationMode(mode) {
|
|
1412
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, mode, "f");
|
|
1413
|
+
}
|
|
1414
|
+
setEditAnnotationMode() {
|
|
1415
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, AnnotationMode.ENABLE_FORMS, "f");
|
|
1416
|
+
}
|
|
1417
|
+
resetAnnotationMode() {
|
|
1418
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, AnnotationMode.ENABLE, "f");
|
|
1419
|
+
}
|
|
1411
1420
|
setFreeTextColor(color) {
|
|
1412
1421
|
this.executeAnnotationCommand({
|
|
1413
1422
|
commandType: AnnotationEditorParamsType.FREETEXT_COLOR,
|
|
@@ -163,9 +163,8 @@ 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
|
|
167
|
-
const
|
|
168
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
166
|
+
const pageHeight = canvas.height;
|
|
167
|
+
const pageWidth = canvas.width;
|
|
169
168
|
printContent.src = canvas.toDataURL();
|
|
170
169
|
printContent.width = pageWidth;
|
|
171
170
|
printContent.height = pageHeight;
|
|
@@ -211,14 +210,14 @@ export class Page extends Component {
|
|
|
211
210
|
renderForPrintAsync() {
|
|
212
211
|
var _a, _b;
|
|
213
212
|
const printUnits = this.pdfViewer.getPrintUnits();
|
|
213
|
+
// this is how pdf.js prints
|
|
214
|
+
const printScale = 1;
|
|
214
215
|
const { canvasContext, canvas } = this.pdfViewer.createPageElements({
|
|
215
216
|
pdfPage: this.pdfPage,
|
|
216
|
-
zoom:
|
|
217
|
+
zoom: printScale,
|
|
217
218
|
printUnits
|
|
218
219
|
});
|
|
219
220
|
this.canvasForPrint = canvas;
|
|
220
|
-
// canvasWrapper.appendChild(canvas);
|
|
221
|
-
// pageElement.appendChild(canvasWrapper);
|
|
222
221
|
this.setState({
|
|
223
222
|
isPrintingInProgress: true
|
|
224
223
|
});
|
|
@@ -228,7 +227,7 @@ export class Page extends Component {
|
|
|
228
227
|
const renderContext = {
|
|
229
228
|
canvasContext: canvasContext,
|
|
230
229
|
transform: [printUnits, 0, 0, printUnits, 0, 0],
|
|
231
|
-
viewport: this.pdfPage.getViewport({ scale:
|
|
230
|
+
viewport: this.pdfPage.getViewport({ scale: printScale, rotation: this.viewport.rotation }),
|
|
232
231
|
intent: "print",
|
|
233
232
|
annotationMode: AnnotationMode.ENABLE_STORAGE,
|
|
234
233
|
optionalContentConfigPromise,
|
|
@@ -1408,6 +1408,15 @@ export class PdfViewer extends Component {
|
|
|
1408
1408
|
setAnnotationEditorMode(modeDescriptor) {
|
|
1409
1409
|
this.annotationEditorMode = modeDescriptor;
|
|
1410
1410
|
}
|
|
1411
|
+
setAnnotationMode(mode) {
|
|
1412
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, mode, "f");
|
|
1413
|
+
}
|
|
1414
|
+
setEditAnnotationMode() {
|
|
1415
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, AnnotationMode.ENABLE_FORMS, "f");
|
|
1416
|
+
}
|
|
1417
|
+
resetAnnotationMode() {
|
|
1418
|
+
__classPrivateFieldSet(this, _PdfViewer_annotationMode, AnnotationMode.ENABLE, "f");
|
|
1419
|
+
}
|
|
1411
1420
|
setFreeTextColor(color) {
|
|
1412
1421
|
this.executeAnnotationCommand({
|
|
1413
1422
|
commandType: AnnotationEditorParamsType.FREETEXT_COLOR,
|
package/dist/npm/widget/page.js
CHANGED
|
@@ -163,9 +163,8 @@ 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
|
|
167
|
-
const
|
|
168
|
-
const pageWidth = Math.floor(viewportRawDimensions.pageWidth);
|
|
166
|
+
const pageHeight = canvas.height;
|
|
167
|
+
const pageWidth = canvas.width;
|
|
169
168
|
printContent.src = canvas.toDataURL();
|
|
170
169
|
printContent.width = pageWidth;
|
|
171
170
|
printContent.height = pageHeight;
|
|
@@ -211,14 +210,14 @@ class Page extends component_1.Component {
|
|
|
211
210
|
renderForPrintAsync() {
|
|
212
211
|
var _a, _b;
|
|
213
212
|
const printUnits = this.pdfViewer.getPrintUnits();
|
|
213
|
+
// this is how pdf.js prints
|
|
214
|
+
const printScale = 1;
|
|
214
215
|
const { canvasContext, canvas } = this.pdfViewer.createPageElements({
|
|
215
216
|
pdfPage: this.pdfPage,
|
|
216
|
-
zoom:
|
|
217
|
+
zoom: printScale,
|
|
217
218
|
printUnits
|
|
218
219
|
});
|
|
219
220
|
this.canvasForPrint = canvas;
|
|
220
|
-
// canvasWrapper.appendChild(canvas);
|
|
221
|
-
// pageElement.appendChild(canvasWrapper);
|
|
222
221
|
this.setState({
|
|
223
222
|
isPrintingInProgress: true
|
|
224
223
|
});
|
|
@@ -228,7 +227,7 @@ class Page extends component_1.Component {
|
|
|
228
227
|
const renderContext = {
|
|
229
228
|
canvasContext: canvasContext,
|
|
230
229
|
transform: [printUnits, 0, 0, printUnits, 0, 0],
|
|
231
|
-
viewport: this.pdfPage.getViewport({ scale:
|
|
230
|
+
viewport: this.pdfPage.getViewport({ scale: printScale, rotation: this.viewport.rotation }),
|
|
232
231
|
intent: "print",
|
|
233
232
|
annotationMode: pdf_mjs_1.AnnotationMode.ENABLE_STORAGE,
|
|
234
233
|
optionalContentConfigPromise,
|
|
@@ -196,6 +196,9 @@ export declare class PdfViewer extends Component {
|
|
|
196
196
|
deleteAnnotation(): void;
|
|
197
197
|
resetAnnotationEditorMode(): void;
|
|
198
198
|
setAnnotationEditorMode(modeDescriptor: any): void;
|
|
199
|
+
setAnnotationMode(mode: any): void;
|
|
200
|
+
setEditAnnotationMode(): void;
|
|
201
|
+
resetAnnotationMode(): void;
|
|
199
202
|
setFreeTextColor(color: any): void;
|
|
200
203
|
setFreeTextFontSize(fontSize: any): void;
|
|
201
204
|
executeAnnotationCommand({ commandType, commandValue }: {
|
|
@@ -1411,6 +1411,15 @@ class PdfViewer extends main_1.Component {
|
|
|
1411
1411
|
setAnnotationEditorMode(modeDescriptor) {
|
|
1412
1412
|
this.annotationEditorMode = modeDescriptor;
|
|
1413
1413
|
}
|
|
1414
|
+
setAnnotationMode(mode) {
|
|
1415
|
+
tslib_1.__classPrivateFieldSet(this, _PdfViewer_annotationMode, mode, "f");
|
|
1416
|
+
}
|
|
1417
|
+
setEditAnnotationMode() {
|
|
1418
|
+
tslib_1.__classPrivateFieldSet(this, _PdfViewer_annotationMode, utils_2.AnnotationMode.ENABLE_FORMS, "f");
|
|
1419
|
+
}
|
|
1420
|
+
resetAnnotationMode() {
|
|
1421
|
+
tslib_1.__classPrivateFieldSet(this, _PdfViewer_annotationMode, utils_2.AnnotationMode.ENABLE, "f");
|
|
1422
|
+
}
|
|
1414
1423
|
setFreeTextColor(color) {
|
|
1415
1424
|
this.executeAnnotationCommand({
|
|
1416
1425
|
commandType: pdf_mjs_1.AnnotationEditorParamsType.FREETEXT_COLOR,
|