diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html index 683bf162..a58298d1 100644 --- a/src/main/resources/templates/sign.html +++ b/src/main/resources/templates/sign.html @@ -179,7 +179,7 @@ select#font-select, select#font-select option {
- + -
@@ -204,10 +203,20 @@ select#font-select, select#font-select option { const textWidth = ctx.measureText(sigText).width; const textHeight = fontSize; + let paragraphs = sigText.split(/\r?\n/); + canvas.width = textWidth; - canvas.height = textHeight*1.35; //for tails + canvas.height = paragraphs.length * textHeight*1.35; //for tails ctx.font = `${fontSize}px ${font}`; - ctx.fillText(sigText, 0, fontSize); + + ctx.textBaseline = 'top'; + + let y = 0; + + paragraphs.forEach(paragraph => { + ctx.fillText(paragraph, 0, y); + y += fontSize; + }); const dataURL = canvas.toDataURL(); DraggableUtils.createDraggableCanvasFromUrl(dataURL);