Mercurial > gemma
changeset 4341:e58affd956c5
pdf-gen: adjust place of text for textbox element
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Fri, 06 Sep 2019 14:39:21 +0200 |
parents | 4d0a09ae0828 |
children | 6a1fef54d49f |
files | client/src/lib/mixins.js |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/lib/mixins.js Fri Sep 06 11:15:49 2019 +0200 +++ b/client/src/lib/mixins.js Fri Sep 06 14:39:21 2019 +0200 @@ -483,8 +483,8 @@ width = this.pdf.doc.getTextWidth(text) + 2 * padding; } let textWidth = width - 2 * padding; + let textLines = this.pdf.doc.splitTextToSize(text, textWidth); if (!height) { - let textLines = this.pdf.doc.splitTextToSize(text, textWidth); height = this.getTextHeight(textLines.length) + 2 * padding; } this.addBox( @@ -499,7 +499,7 @@ if (["bottomright", "bottomleft"].indexOf(position) !== -1) { this.addText( position, - { x: offset.x + padding, y: offset.y - padding / 2 }, + { x: offset.x + padding, y: offset.y }, textWidth, fontSize, color, @@ -508,7 +508,10 @@ } else { this.addText( position, - { x: offset.x + padding, y: offset.y + padding * 2 }, + { + x: offset.x + padding, + y: offset.y + height - this.getTextHeight(textLines.length) + }, textWidth, fontSize, color,