feat: add PDF password prompt and centralized pdf-lib loader with auto-repair

This commit is contained in:
alam00000
2026-03-26 14:42:48 +05:30
parent 9278774b8a
commit bd44108296
19 changed files with 89 additions and 78 deletions

View File

@@ -436,9 +436,7 @@ async function loadPdfs(files: File[]) {
pwResult.pdf.destroy();
arrayBuffer = pwResult.bytes as ArrayBuffer;
const pdfDoc = await loadPdfDocument(arrayBuffer, {
throwOnInvalidObject: false,
});
const pdfDoc = await loadPdfDocument(arrayBuffer);
currentPdfDocs.push(pdfDoc);
const pdfIndex = currentPdfDocs.length - 1;
@@ -859,9 +857,7 @@ async function handleInsertPdf(e: Event) {
if (!pwResult) return;
pwResult.pdf.destroy();
const pdfDoc = await loadPdfDocument(pwResult.bytes, {
throwOnInvalidObject: false,
});
const pdfDoc = await loadPdfDocument(pwResult.bytes);
currentPdfDocs.push(pdfDoc);
const pdfIndex = currentPdfDocs.length - 1;