diff client/src/lib/mixins.js @ 3799:f4deb4aae485 yworks-svg2pdf

client: improve pdf generation * Refactor Fairwayprofile.vue to use generatedPDF() from mixins.js. * Fix generatedPDF() to use parameters for templateData at one remaining point.
author Bernhard Reiter <bernhard@intevation.de>
date Thu, 04 Jul 2019 10:29:48 +0200
parents e008197e2215
children 1399d31531f7
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Thu Jul 04 10:15:46 2019 +0200
+++ b/client/src/lib/mixins.js	Thu Jul 04 10:29:48 2019 +0200
@@ -84,14 +84,12 @@
     },
     generatePDF(params) {
       // creates a new jsPDF object into this.pdf.doc
+      // will call functions that the calling context has to provide
+      // as specified in the templateData
       let templateData = params["templateData"];
       let diagramTitle = params["diagramTitle"];
 
-      this.pdf.doc = new jsPDF(
-        "l",
-        "mm",
-        this.templateData.properties.paperSize
-      );
+      this.pdf.doc = new jsPDF("l", "mm", templateData.properties.paperSize);
       // pdf width and height in millimeter (landscape)
       if (templateData.properties.paperSize === "a3") {
         this.pdf.width = 420;
@@ -189,7 +187,6 @@
         });
       }
     },
-
     // add text at specific coordinates and do line breaks
     addText(position, offset, width, fontSize, color, text) {
       text = this.replacePlaceholders(text);