changeset 1932:e734d48ef964

client: cleanup code: remove browser based printing css attempt * Remove unused css and code (disabled and enabled) for printing based on the browsers printing functionality. Pdftool.vue creates a pdf in javascript directly.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 21 Jan 2019 12:21:01 +0100
parents 8fb1b1a8ea85
children 1aa2921d8832
files client/src/components/Maplayer.vue
diffstat 1 files changed, 1 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue	Mon Jan 21 12:10:12 2019 +0100
+++ b/client/src/components/Maplayer.vue	Mon Jan 21 12:21:01 2019 +0100
@@ -14,25 +14,6 @@
 .mapfull {
   height: 100vh;
 }
-
-// the following css part is for browser-printing based pdf generation
-@page {
-  size: A4 landscape !important;
-  margin: 4mm !important;
-  // according to https://www.w3.org/TR/css-page-3/#page-size-prop
-  // we shall now have 210 - 2*4 = 202 mm width and 297 - 2*4 = 289 mm height
-}
-
-@media print {
-  .mapfull {
-    width: 2000px;
-    height: 2828px;
-  }
-  .mapsplit {
-    width: 2000px;
-    height: 2828px;
-  }
-}
 </style>
 
 <script>
@@ -42,7 +23,7 @@
  * SPDX-License-Identifier: AGPL-3.0-or-later
  * License-Filename: LICENSES/AGPL-3.0.txt
  *
- * Copyright (C) 2018 by via donau
+ * Copyright (C) 2018, 2019 by via donau
  *   – Österreichische Wasserstraßen-Gesellschaft mbH
  * Software engineering by Intevation GmbH
  *
@@ -155,34 +136,6 @@
       }
       layer.isVisible = exists;
       layer.data.setVisible(exists);
-    },
-    onBeforePrint(/* evt */) {
-      // console.log("onBeforePrint(", evt ,")");
-      //
-      // the following code shows how to get the current map canvas
-      // and change it, however this does not work well enough, as
-      // another mechanism seems to update the size again before the rendering
-      // for printing is done:
-      // console.log(this.openLayersMap.getViewport());
-      // var canvas = this.openLayersMap.getViewport().getElementsByTagName("canvas")[0];
-      // console.log(canvas);
-      // canvas.width=1000;
-      // canvas.height=1414;
-      //
-      // An experiment which also did not work:
-      // this.openLayersMap.setSize([1000, 1414]); // estimate portait DIN A4
-      //
-      // according to documentation
-      // http://openlayers.org/en/latest/apidoc/module-ol_PluggableMap-PluggableMap.html#updateSize
-      // "Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport."
-      // but did not help
-      // this.openLayersMap.updateSize();
-    },
-    onAfterPrint(/* evt */) {
-      // could be used to undo changes that have been done for printing
-      // though https://www.tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/
-      // reported that this was not feasable (back then).
-      // console.log("onAfterPrint(", evt, ")");
     }
   },
   watch: {
@@ -373,9 +326,6 @@
         console.log(error);
       });
 
-    window.addEventListener("beforeprint", this.onBeforePrint);
-    window.addEventListener("afterprint", this.onAfterPrint);
-
     // so none is shown
     this.updateBottleneckFilter("does_not_exist", "1999-10-01");
     this.$store.dispatch("map/enableIdentifyTool");