Skip to content

Commit d314640

Browse files
committed
fix: 🐛 修复 PWA 上使用卷轴模式时 PDF 显示模糊的 bug
#290
1 parent bcfef7d commit d314640

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/pwa/src/fileParser/pdf.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,11 @@ export const handlePdf = async (file: File): Promise<ImgFile[]> => {
3636
plimit(
3737
range(pdf.numPages, (i) => async () => {
3838
const page = await pdf.getPage(i + 1);
39-
const [, , width, height] = page.view;
39+
const [, , width] = page.view;
4040
let scale = 1;
4141

42-
// 缩放图片适应屏幕
43-
if (height > width) {
44-
if (height < document.body.clientHeight)
45-
scale = document.body.clientHeight / height;
46-
} else if (width < document.body.clientWidth)
42+
// 缩放图片适应页宽
43+
if (width < document.body.clientWidth)
4744
scale = document.body.clientWidth / width;
4845

4946
const viewport = page.getViewport({ scale });

0 commit comments

Comments
 (0)