Verify stored PDF retry in browser and clarify upload errors

This commit is contained in:
2026-09-06 09:41:17 +03:00
parent 277c9407a2
commit 01d4acf246
7 changed files with 358 additions and 2 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ const DocumentVaultSession = ({signedIn}) => {
</div>
<div>
<h3 className="font-bold text-sm text-slate-800">Belge Yükleyin</h3>
<p className="text-xs text-slate-500">İmza sirküleri, sertifikalar, vergi levhası… (en fazla 8 MB)</p>
<p className="text-xs text-slate-500">İmza sirküleri, sertifikalar, vergi levhası… (en fazla 10 MB)</p>
</div>
<div className="flex justify-center gap-2 flex-wrap">
<select value={kategori} onChange={(e) => setKategori(e.target.value)}
+7 -1
View File
@@ -10,7 +10,13 @@ export async function extractPdfText(file, { maxPages = 40 } = {}) {
pdfjs.GlobalWorkerOptions.workerSrc = workerUrl;
const buf = await file.arrayBuffer();
const doc = await pdfjs.getDocument({ data: buf }).promise;
let doc;
try { doc = await pdfjs.getDocument({ data: buf }).promise; }
catch (error) {
if (error.name === 'InvalidPDFException') throw new Error('PDF dosyası bozuk veya geçerli PDF biçiminde değil.');
if (error.name === 'PasswordException') throw new Error('PDF parola korumalı; okunabilir bir kopyasını yükleyin.');
throw new Error('PDF okunamadı. Dosyayı kontrol edip yeniden deneyin.');
}
const pages = Math.min(doc.numPages, maxPages);
const parts = [];
for (let i = 1; i <= pages; i++) {