Skip to content

Commit 3430a94

Browse files
viownkevgrig
authored andcommitted
Backport pull request jellyfin#6298 from jellyfin-web/release-10.10.z
Fix large PDF Display Original-merge: 048d3f1 Merged-by: thornbill <[email protected]> Backported-by: Joshua M. Boniface <[email protected]>
1 parent 5d03c57 commit 3430a94

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/plugins/pdfPlayer/plugin.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,20 @@ export class PdfPlayer {
293293
const devicePixelRatio = window.devicePixelRatio || 1;
294294
this.book.getPage(number).then(page => {
295295
const original = page.getViewport({ scale: 1 });
296-
const scale = Math.max((window.screen.height / original.height), (window.screen.width / original.width)) * devicePixelRatio;
296+
const scale = Math.min((window.innerHeight / original.height), (window.innerWidth / original.width)) * devicePixelRatio;
297297
const viewport = page.getViewport({ scale });
298298

299299
canvas.width = viewport.width;
300300
canvas.height = viewport.height;
301301

302+
if (window.innerWidth < window.innerHeight) {
303+
canvas.style.width = '100%';
304+
canvas.style.height = 'auto';
305+
} else {
306+
canvas.style.height = '100%';
307+
canvas.style.width = 'auto';
308+
}
309+
302310
const context = canvas.getContext('2d');
303311

304312
const renderContext = {

0 commit comments

Comments
 (0)