@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.
@@ -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 viewportRawDimensions = this.viewport.rawDims;
167
- const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
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: 1,
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: 1, rotation: this.viewport.rotation }),
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 viewportRawDimensions = this.viewport.rawDims;
167
- const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
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: 1,
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: 1, rotation: this.viewport.rotation }),
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 @@ 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 viewportRawDimensions = this.viewport.rawDims;
167
- const pageHeight = Math.floor(viewportRawDimensions.pageHeight);
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: 1,
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: 1, rotation: this.viewport.rotation }),
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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-pdfviewer-common",
3
3
  "description": "Kendo UI TypeScript package exporting functions for PDFViewer component",
4
- "version": "0.5.0",
4
+ "version": "0.5.1-develop.1",
5
5
  "keywords": [
6
6
  "Kendo UI"
7
7
  ],