# HG changeset patch # User Markus Kottlaender # Date 1550485351 -3600 # Node ID da6611071a58906250315194dc8b7683abc7b0ff # Parent b6cd295bf75dc1720d91cd50b32750a875463b34 client: pdf-gen: fixed width calculation of textbox diff -r b6cd295bf75d -r da6611071a58 client/src/components/Pdftool.vue --- a/client/src/components/Pdftool.vue Mon Feb 18 11:16:13 2019 +0100 +++ b/client/src/components/Pdftool.vue Mon Feb 18 11:22:31 2019 +0100 @@ -456,13 +456,14 @@ background, text ) { + this.pdf.doc.setFontSize(fontSize); + text = this.replacePlaceholders(text); + if (!width) { - width = Math.max(this.pdf.doc.getTextWidth(text)) + padding; + width = this.pdf.doc.getTextWidth(text) + 2 * padding; } let textWidth = width - 2 * padding; if (!height) { - this.pdf.doc.setFontSize(fontSize); - text = this.replacePlaceholders(text); let textLines = this.pdf.doc.splitTextToSize(text, textWidth); height = this.getTextHeight(textLines.length) + 2 * padding; }