vue-pdf-eurlanda
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "vue-pdf-eurlanda", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "vue.js pdf viewer", | ||
@@ -5,0 +5,0 @@ "main": "src/vuePdfNoSss.vue", |
@@ -102,3 +102,9 @@ import resizeSensor from 'vue-resize-sensor' | ||
this.$on('loaded', function() { | ||
let docheight = document.getElementById(this.container).offsetHeight; | ||
let calHeight = this.pdf.getCanvas().offsetWidth * (this.pdf.getCanvas().height / this.pdf.getCanvas().width); | ||
if (calHeight > docheight) { | ||
calHeight = docheight; | ||
} | ||
this.pdf.setCanvasHeight(calHeight + 'px'); | ||
this.pdf.loadPage(this.page, this.rotate); | ||
@@ -105,0 +111,0 @@ }); |
@@ -230,4 +230,2 @@ import { CMapCompressionType } from 'pdfjs-dist/lib/shared/util'; | ||
console.log("-------容器的大小--------"); | ||
console.log(canvasElt.offsetWidth, canvasElt.offsetHeight); | ||
var scale = canvasElt.offsetWidth / pdfPage.getViewport(1).width * (window.devicePixelRatio || 1); | ||
@@ -245,4 +243,3 @@ //如果按照宽度计算下来的比例。大于容器的高度,那么按照容器高度来进行比例计算 | ||
canvasElt.height = viewport.height; | ||
console.log("------计算后的大小------"); | ||
console.log(viewport.width, viewport.height); | ||
canvasElt.style.width = viewport.width + "px"; | ||
pdfRender = pdfPage.render({ | ||
@@ -249,0 +246,0 @@ canvasContext: canvasElt.getContext('2d'), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32228
531