|
|
|
@@ -217,8 +217,9 @@ async function pdfToImageItems( |
|
|
|
onProgress: (page: number, total: number) => void
|
|
|
|
): Promise<MediaItem[]> {
|
|
|
|
const pdfjs = await import('pdfjs-dist');
|
|
|
|
// Worker file is copied to /public via the postinstall script
|
|
|
|
pdfjs.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
|
|
|
|
// Worker file is copied to /public via the postinstall script. Must include the
|
|
|
|
// basePath so the browser can find it when the app is mounted under /cards.
|
|
|
|
pdfjs.GlobalWorkerOptions.workerSrc = withBasePath('/pdf.worker.min.mjs');
|
|
|
|
|
|
|
|
const arrayBuffer = await file.arrayBuffer();
|
|
|
|
const pdf = await pdfjs.getDocument({ data: arrayBuffer }).promise;
|
|
|
|
@@ -505,7 +506,8 @@ export default function AdminDashboard() { |
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error('Upload failed for', file.name, err);
|
|
|
|
showToast(`Failed to process "${file.name}".`);
|
|
|
|
const reason = (err as Error)?.message || 'unknown error';
|
|
|
|
showToast(`Failed to process "${file.name}": ${reason}. Check the browser console for details.`, 'error');
|
|
|
|
setPdfProgress(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|