vue-pdf-eurlanda
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "vue-pdf-eurlanda", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "vue.js pdf viewer", | ||
@@ -5,0 +5,0 @@ "main": "src/vuePdfNoSss.vue", |
@@ -73,2 +73,3 @@ import resizeSensor from 'vue-resize-sensor' | ||
return; | ||
let calHeight = this.pdf.getCanvas().offsetWidth * (this.pdf.getCanvas().height / this.pdf.getCanvas().width); | ||
@@ -116,3 +117,2 @@ if (calHeight > height) { | ||
//let width = document.getElementById(this.container).offsetWidth; | ||
tnis.pdf.getCanvas().style.width = width + "px"; | ||
let docheight = document.getElementById(this.container).offsetHeight; | ||
@@ -119,0 +119,0 @@ let calHeight = this.pdf.getCanvas().offsetWidth * (this.pdf.getCanvas().height / this.pdf.getCanvas().width); |
@@ -229,9 +229,14 @@ import { CMapCompressionType } from 'pdfjs-dist/lib/shared/util'; | ||
} | ||
var scale = canvasElt.offsetWidth / pdfPage.getViewport(1).width * (window.devicePixelRatio || 1); | ||
//如果按照宽度计算下来的比例。大于容器的高度,那么按照容器高度来进行比例计算 | ||
if (pdfPage.getViewport(1).height * scale > canvasElt.offsetHeight) { | ||
scale = canvasElt.offsetHeight / pdfPage.getViewport(1).height * (window.devicePixelRatio || 1); | ||
//这里先使用高度作为缩放比例 | ||
var scale = canvasElt.offsetHeight / pdfPage.getViewport(1).width * (window.devicePixelRatio || 1); | ||
//计算如果使用高度作为缩放比例,计算宽度 | ||
var calWidth = pdfPage.getViewport(1) * scale; | ||
//如果使用宽度比例计算下来的宽度大于容器的宽度,那么使用宽度作为缩放比例 | ||
if (calWidth > canvasElt.offsetWidth) { | ||
scale = canvasElt.offsetWidth / pdfPage.getViewport(1).width * (window.devicePixelRatio || 1); | ||
//如果按照宽度计算下来的比例。大于容器的高度,那么按照容器高度来进行比例计算 | ||
if (pdfPage.getViewport(1).height * scale > canvasElt.offsetHeight) { | ||
scale = canvasElt.offsetHeight / pdfPage.getViewport(1).height * (window.devicePixelRatio || 1); | ||
} | ||
} | ||
var viewport = pdfPage.getViewport(scale, rotate); | ||
@@ -243,2 +248,3 @@ | ||
canvasElt.height = viewport.height; | ||
canvasElt.style.width = viewport.width + 'px'; | ||
pdfRender = pdfPage.render({ | ||
@@ -391,3 +397,3 @@ canvasContext: canvasElt.getContext('2d'), | ||
annotationLayerElt.style.transformOrigin = '0 0'; | ||
//annotationLayerElt.style.transformOrigin = '0 0'; | ||
} | ||
@@ -394,0 +400,0 @@ |
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
32728
538