diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 4e4554adb2a..cb5023ad4ea 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -291,13 +291,22 @@ export class PdfPlayer { renderPage(canvas, number) { this.book.getPage(number).then(page => { + const devicePixelRatio = (window.devicePixelRatio || 1); const original = page.getViewport({ scale: 1 }); - const scale = Math.min((window.innerHeight / original.height), (window.innerWidth / original.width)); + const scale = Math.min((window.innerHeight / original.height), (window.innerWidth / original.width)) * devicePixelRatio; const viewport = page.getViewport({ scale }); canvas.width = viewport.width; canvas.height = viewport.height; + if (window.innerWidth < window.innerHeight) { + canvas.style.width = '100%'; + canvas.style.height = 'auto'; + } else { + canvas.style.height = '100%'; + canvas.style.width = 'auto'; + } + const context = canvas.getContext('2d'); const renderContext = {