comparison client/src/components/Pdftool.vue @ 2138:4a903d382901

client: pdf-gen: make bottleneck infos more fancy * Use different font styles to beautify the bottleneck details on the pdf. This also demonstrates how to calculate the size of text elements for laout purposes.
author Bernhard Reiter <bernhard@intevation.de>
date Wed, 06 Feb 2019 17:05:10 +0100
parents a31c9fa47ab8
children a08e0f532304 82867a69e10e
comparison
equal deleted inserted replaced
2137:a31c9fa47ab8 2138:4a903d382901
484 50 / aspectRatio 484 50 / aspectRatio
485 ); 485 );
486 }, 486 },
487 addBottleneckInfo(doc, height, docWidth) { 487 addBottleneckInfo(doc, height, docWidth) {
488 this.addRoundedBox(doc, docWidth - 54, 0, 54, height); 488 this.addRoundedBox(doc, docWidth - 54, 0, 54, height);
489 let str1 = this.$gettext("Bottleneck") + ": " + this.selectedBottleneck; 489
490 this.addText(doc, docWidth - 51, 4, 8, "black", 46, str1); 490 console.log("Fontlist =", doc.getFontList());
491 491 doc.setFont("times", "normal");
492 let survey = this.selectedSurvey; 492
493 493 let name, w, str;
494 let str2 = this.$gettext("Survey date") + ": " + survey.date_info; 494
495 this.addText(doc, docWidth - 51, 7.5, 8, "black", 46, str2); 495 doc.setFontStyle("italic");
496 496 name = this.$gettext("Bottleneck") + ": ";
497 let str3 = this.$gettext("Ref gauge") + ": " + survey.gauge_objname; 497 w = doc.getTextWidth(name);
498 this.addText(doc, docWidth - 51, 11, 8, "black", 46, str3); 498 this.addText(doc, docWidth - 51, 4, 8, "black", 46, name);
499 doc.setFontStyle("bold");
500 str = this.selectedBottleneck;
501 this.addText(doc, docWidth - 51 + w, 4, 8, "black", 46, str);
502
503 doc.setFontStyle("italic");
504 name = this.$gettext("Survey date") + ": ";
505 w = doc.getTextWidth(name);
506 this.addText(doc, docWidth - 51, 7.5, 8, "black", 46, name);
507 doc.setFontStyle("normal");
508 str = this.selectedSurvey.date_info;
509 this.addText(doc, docWidth - 51 + w, 7.5, 8, "black", 46, str);
510
511 doc.setFontStyle("italic");
512 name = this.$gettext("Ref gauge") + ": ";
513 w = doc.getTextWidth(name);
514 this.addText(doc, docWidth - 51, 11, 8, "black", 46, name);
515 doc.setFontStyle("normal");
516 str = this.selectedSurvey.gauge_objname;
517 this.addText(doc, docWidth - 51 + w, 11, 8, "black", 46, str);
499 } 518 }
500 } 519 }
501 }; 520 };
502 </script> 521 </script>