Skip to content

Commit 2a4e4cd

Browse files
committed
fix: 🐛 修复 PWA 上部分 PDF 显示空白图片的 bug
#290
1 parent 30e4af3 commit 2a4e4cd

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/pwa/public/pdfJsWasm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:/Users/hymbz/GitHub/ComicReadScript/node_modules/pdfjs-dist/wasm

src/pwa/src/fileParser/pdf.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export const handlePdf = async (file: File): Promise<ImgFile[]> => {
2020
outputScale === 1 ? undefined : [outputScale, 0, 0, outputScale, 0, 0];
2121

2222
try {
23-
const task = pdfjsLib.getDocument(await file.arrayBuffer());
23+
const task = pdfjsLib.getDocument({
24+
data: await file.arrayBuffer(),
25+
wasmUrl: '/pdfJsWasm/',
26+
});
2427
task.onPassword = (updatePassword: (password: string) => void) => {
2528
// eslint-disable-next-line no-alert
2629
const password = prompt(t('pwa.message.enter_password'));

0 commit comments

Comments
 (0)