Skip to content

Commit 34a2847

Browse files
committed
Fix issue with password
1 parent 47d8617 commit 34a2847

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

examples/vue-tailwind/src/components/DocumentPasswordPrompt.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ const handleSubmit = async () => {
9696
errorMessage.value = '';
9797
9898
try {
99-
await documentManager.retryLoadDocumentWithPassword(props.documentState.id, password.value);
99+
await documentManager.value?.retryDocument(props.documentState.id, {
100+
password: password.value,
101+
});
100102
} catch (error) {
101103
errorMessage.value = 'Incorrect password. Please try again.';
102104
password.value = '';
@@ -108,6 +110,6 @@ const handleSubmit = async () => {
108110
109111
const handleCancel = () => {
110112
if (!documentManager) return;
111-
documentManager.closeDocument(props.documentState.id);
113+
documentManager.value?.closeDocument(props.documentState.id);
112114
};
113115
</script>

packages/engines/src/lib/orchestrator/pdf-engine.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ export class PdfEngine<T = Blob> implements IPdfEngine<T> {
165165
content: arrayBuf,
166166
};
167167

168-
// Then open in worker
169-
const doc = await this.openDocumentBuffer(pdfFile, {
168+
// Then open in worker - use wait() to properly propagate task errors
169+
this.openDocumentBuffer(pdfFile, {
170170
password: options?.password,
171-
}).toPromise();
172-
173-
task.resolve(doc);
171+
}).wait(
172+
(doc) => task.resolve(doc),
173+
(error) => task.fail(error),
174+
);
174175
} catch (error) {
176+
// This only catches fetch errors (network issues, etc.)
175177
task.reject({ code: PdfErrorCode.Unknown, message: String(error) });
176178
}
177179
})();

0 commit comments

Comments
 (0)