comparison client/src/lib/mixins.js @ 3919:2c9e96b02573

clinet: pdf-gen: improve addTextBox() function for template
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 11 Jul 2019 15:14:53 +0200
parents ec1d91fdd6a2
children d859ec6cf2f0
comparison
equal deleted inserted replaced
3918:1e837d86bead 3919:2c9e96b02573
290 // the size of the element 290 // the size of the element
291 if (["topright", "bottomright"].indexOf(position) !== -1) { 291 if (["topright", "bottomright"].indexOf(position) !== -1) {
292 x = this.pdf.width - offset.x - width; 292 x = this.pdf.width - offset.x - width;
293 } 293 }
294 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { 294 if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
295 y = this.pdf.height - offset.y - this.getTextHeight(textLines.length); 295 y =
296 this.pdf.height -
297 offset.y * 0.3 -
298 this.getTextHeight(textLines.length);
296 } 299 }
297 this.pdf.doc.text(textLines, x, y, { baseline: "hanging" }); 300 this.pdf.doc.text(textLines, x, y, { baseline: "hanging" });
298 }, 301 },
299 replacePlaceholders(text) { 302 replacePlaceholders(text) {
300 if (text.includes("{date}")) { 303 if (text.includes("{date}")) {
420 background, 423 background,
421 brcolor 424 brcolor
422 ); 425 );
423 this.addText( 426 this.addText(
424 position, 427 position,
425 { x: offset.x + padding, y: offset.y + padding }, 428 { x: offset.x + padding, y: offset.y + padding * 2 },
426 textWidth, 429 textWidth,
427 fontSize, 430 fontSize,
428 color, 431 color,
429 text 432 text
430 ); 433 );