Skip to content

Commit

Permalink
[bug] fix bug 71119
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyLuzyanin committed Nov 8, 2024
1 parent 4f57ee5 commit 0c064da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion common/apiCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5077,7 +5077,13 @@ function (window, undefined) {
let ctx = canvasTransparent.getContext("2d");
ctx.globalAlpha = this.transparent;
ctx.drawImage(this.image, 0, 0);
this.imageBase64 = canvasTransparent.toDataURL("image/png");
try {
this.imageBase64 = canvasTransparent.toDataURL("image/png");
}
catch (e) {
this.imageBase64 = undefined;
this.api.sendEvent("asc_onError", Asc.c_oAscError.ID.CannotSaveWatermark, Asc.c_oAscError.Level.NoCritical);
}
canvasTransparent = null;
};
this.EndRenderer = function () {
Expand All @@ -5087,6 +5093,9 @@ function (window, undefined) {
this.imageBase64 = undefined;
};
this.DrawOnRenderer = function (renderer, w, h) {
if(!this.imageBase64) {
return;
}
let wMM = this.width * AscCommon.g_dKoef_pix_to_mm / this.zoom;
let hMM = this.height * AscCommon.g_dKoef_pix_to_mm / this.zoom;
let x = (w - wMM) / 2;
Expand Down Expand Up @@ -5190,6 +5199,10 @@ function (window, undefined) {
if (undefined != align) {
oShape.setVerticalAlign(align);
}
else {

oShape.setVerticalAlign(1);//ctr
}

if (Array.isArray(obj['margins']) && obj['margins'].length === 4) {
oShape.setPaddings({
Expand Down
2 changes: 2 additions & 0 deletions common/errorCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
ConvertationOpenLimitError : -84,
ConvertationOpenFormat : -85,

CannotSaveWatermark : -86,

UserDrop : -100,
Warning : -101,
UpdateVersion : -102,
Expand Down

0 comments on commit 0c064da

Please sign in to comment.