test scale

This commit is contained in:
邱博亞 2023-09-16 14:23:50 +08:00
parent eae14bb93f
commit 0e74f38d16
1 changed files with 3 additions and 2 deletions

View File

@ -847,7 +847,7 @@
enableXfa: ENABLE_XFA,
disableFontFace: true
});
var pdfDoc = null, scale = 2.5;
var pdfDoc = null, scale = window.devicePixelRatio || 1;
const container = flipbook[0];
flipbook.bind('zoom-min', function(){
flipbook_container.find('.cmdZoomOut').addClass('disabled');
@ -889,6 +889,7 @@
var viewport = page.getViewport({ scale: scale });
// Support HiDPI-screens.
var outputScale = (window.devicePixelRatio || 1) / 4;
outputScale = outputScale / viewport.width * flipbook.width();
canvas.width = Math.floor(viewport.width * outputScale);
canvas.height = Math.floor(viewport.height * outputScale);
canvas.style.width = "100%";
@ -1082,7 +1083,7 @@
var viewport = page.getViewport({ scale: scale });
// Support HiDPI-screens.
var outputScale = window.devicePixelRatio || 1;
outputScale = outputScale / viewport.width * flipbook.width();
canvas.width = Math.floor(viewport.width * outputScale);
canvas.height = Math.floor(viewport.height * outputScale);
canvas.style.width = "100%";