feat: enable loading of encrypted PDFs by adding ignoreEncryption option

This commit is contained in:
alam00000
2026-03-26 12:55:50 +05:30
parent 816dc311ae
commit 9d362b1cf8
24 changed files with 56 additions and 17 deletions
+2 -2
View File
@@ -792,7 +792,7 @@ export async function loadPdfWithPasswordPrompt(
let currentFile = file;
try {
const pdf = await getPDFDocument(bytes).promise;
const pdf = await getPDFDocument(bytes.slice(0)).promise;
return { pdf, bytes, file: currentFile };
} catch (err: unknown) {
if (
@@ -808,7 +808,7 @@ export async function loadPdfWithPasswordPrompt(
files[index] = decryptedFile;
}
bytes = (await readFileAsArrayBuffer(decryptedFile)) as ArrayBuffer;
const pdf = await getPDFDocument(bytes).promise;
const pdf = await getPDFDocument(bytes.slice(0)).promise;
return { pdf, bytes, file: currentFile };
}
throw err;