mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Refactor PDF mounting process to use ArrayBuffer
Changed mountPdf function to accept an ArrayBuffer instead of a URL. This improves handling of documents by simplifying the data flow and eliminates the need for URL object creation.
This commit is contained in:
parent
00408b91a9
commit
4e0a421a03
@ -277,8 +277,8 @@ const signature = window.signature;
|
|||||||
|
|
||||||
console.log(signature);
|
console.log(signature);
|
||||||
|
|
||||||
const mountPdf = async (url: string) => {
|
const mountPdf = async (doc: ArrayBuffer) => {
|
||||||
const loadingTask = pdfjsLib.getDocument(url);
|
const loadingTask = pdfjsLib.getDocument(doc);
|
||||||
pdf = await loadingTask.promise;
|
pdf = await loadingTask.promise;
|
||||||
pageCount.value = pdf.numPages;
|
pageCount.value = pdf.numPages;
|
||||||
await setPage(page.value);
|
await setPage(page.value);
|
||||||
@ -317,7 +317,8 @@ async function downloadAndOpen(): Promise<Blob> {
|
|||||||
console.error("error while downloading and decrypting document", e);
|
console.error("error while downloading and decrypting document", e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
await mountPdf(URL.createObjectURL(raw));
|
const doc = await raw.arrayBuffer();
|
||||||
|
await mountPdf(doc);
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user