Mercurial > gemma
comparison client/src/components/Pdftool.vue @ 4454:69166db6ba8a
console.log removed
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 23 Sep 2019 09:19:03 +0200 |
parents | c0bfe7283384 |
children | 3543af71d04c |
comparison
equal
deleted
inserted
replaced
4453:9b9f60e26b39 | 4454:69166db6ba8a |
---|---|
260 * | 260 * |
261 * Details: https://gis.stackexchange.com/questions/328933/openlayers-generating-clientside-pdfs | 261 * Details: https://gis.stackexchange.com/questions/328933/openlayers-generating-clientside-pdfs |
262 * | 262 * |
263 */ | 263 */ |
264 this.readyToGenerate = false; | 264 this.readyToGenerate = false; |
265 console.log( | |
266 "will generate pdf with", | |
267 this.form.paperSize, | |
268 this.form.format, | |
269 this.form.resolution | |
270 ); | |
271 | |
272 if (this.form.format !== "portrait") { | 265 if (this.form.format !== "portrait") { |
273 this.pdf.width = paperSizes[this.form.paperSize][0]; | 266 this.pdf.width = paperSizes[this.form.paperSize][0]; |
274 this.pdf.height = paperSizes[this.form.paperSize][1]; | 267 this.pdf.height = paperSizes[this.form.paperSize][1]; |
275 } else { | 268 } else { |
276 this.pdf.width = paperSizes[this.form.paperSize][1]; | 269 this.pdf.width = paperSizes[this.form.paperSize][1]; |
298 this.openLayersMap() | 291 this.openLayersMap() |
299 .getView() | 292 .getView() |
300 .getResolution() | 293 .getResolution() |
301 ) | 294 ) |
302 ); | 295 ); |
303 console.log("scaleDenominator = ", scaleDenominator); | |
304 var snapshot = canvas.toDataURL("image/jpeg"); | 296 var snapshot = canvas.toDataURL("image/jpeg"); |
305 this.pdf.doc.addImage( | 297 this.pdf.doc.addImage( |
306 snapshot, | 298 snapshot, |
307 "JPEG", | 299 "JPEG", |
308 0, | 300 0, |
516 unitConversionFactor = 1e3; | 508 unitConversionFactor = 1e3; |
517 } | 509 } |
518 | 510 |
519 maxLength /= unitConversionFactor; | 511 maxLength /= unitConversionFactor; |
520 | 512 |
521 // DEBUG console.log(maxLength, unit); | |
522 let unroundedLength = maxLength; | 513 let unroundedLength = maxLength; |
523 let numberOfDigits = Math.floor(log10(unroundedLength)); | 514 let numberOfDigits = Math.floor(log10(unroundedLength)); |
524 let factor = Math.pow(10, numberOfDigits); | 515 let factor = Math.pow(10, numberOfDigits); |
525 let mapped = unroundedLength / factor; | 516 let mapped = unroundedLength / factor; |
526 // DEBUG console.log(mapped); | |
527 | 517 |
528 var length = Math.floor(maxLength); // just to have an upper limit | 518 var length = Math.floor(maxLength); // just to have an upper limit |
529 | 519 |
530 // manually only use numbers that are very nice to devide by 4 | 520 // manually only use numbers that are very nice to devide by 4 |
531 // note that this is taken into account for rounding later | 521 // note that this is taken into account for rounding later |