diff --git a/apps/OpenSign/src/components/pdf/SignPad.js b/apps/OpenSign/src/components/pdf/SignPad.js index 627d7a857..64db3b88f 100644 --- a/apps/OpenSign/src/components/pdf/SignPad.js +++ b/apps/OpenSign/src/components/pdf/SignPad.js @@ -1,6 +1,5 @@ import React, { useRef, useState, useEffect } from "react"; import SignatureCanvas from "react-signature-canvas"; - function SignPad({ isSignPad, isStamp, @@ -100,6 +99,12 @@ function SignPad({ if (isTab === "type") { setIsSignImg(""); onSaveSign(null, false, textWidth, textHeight); + onSaveSign( + null, + false, + textWidth > 150 ? 150 : textWidth, + textHeight > 35 ? 35 : textHeight + ); } else { setIsSignImg(""); canvasRef.current.clear(); @@ -215,7 +220,7 @@ function SignPad({ //creating span for getting text content width const span = document.createElement("span"); span.textContent = textContent; - span.style.font = `20px ${fontfamily}`; // here put your text size and font family + span.style.font = `40px ${fontfamily}`; // here put your text size and font family span.style.color = color ? color : penColor; span.style.display = "hidden"; document.body.appendChild(span); // Replace 'container' with the ID of the container element @@ -225,7 +230,8 @@ function SignPad({ // Draw the text content on the canvas const ctx = canvasElement.getContext("2d"); const pixelRatio = window.devicePixelRatio || 1; - const width = span.offsetWidth; + const addExtraWidth = isInitial ? 0 : 50; + const width = span.offsetWidth + addExtraWidth; const height = span.offsetHeight; setTextWidth(width); setTextHeight(height);