1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4347 from Zourlo/blurred-pdf-fixed

Fix Blurred pdf
This commit is contained in:
Bill Thornton 2023-04-12 00:03:18 -04:00 committed by GitHub
commit 02250c740f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -279,16 +279,22 @@ export class PdfPlayer {
renderPage(canvas, number) {
this.book.getPage(number).then(page => {
const original = page.getViewport({ scale: 1 });
const width = dom.getWindowSize().innerWidth;
const height = dom.getWindowSize().innerHeight;
const scale = Math.ceil(window.devicePixelRatio || 1);
const viewport = page.getViewport({ scale });
const context = canvas.getContext('2d');
const widthRatio = dom.getWindowSize().innerWidth / original.width;
const heightRatio = dom.getWindowSize().innerHeight / original.height;
const scale = Math.min(heightRatio, widthRatio);
const viewport = page.getViewport({ scale: scale });
canvas.width = viewport.width;
canvas.height = viewport.height;
if (width < height) {
canvas.style.width = '100%';
canvas.style.height = 'auto';
} else {
canvas.style.height = '100%';
canvas.style.width = 'auto';
}
const renderContext = {
canvasContext: context,
viewport: viewport