feat(scan): whiten receipt backgrounds and embed OCR in PDFs
This commit is contained in:
@@ -34,6 +34,9 @@ const scanForm = reactive({
|
||||
source: "ADF Duplex",
|
||||
paperSize: "A4",
|
||||
postprocess: false,
|
||||
backgroundCleanup: true,
|
||||
ocr: true,
|
||||
ocrLanguage: "deu+eng",
|
||||
postprocessProfile: "document"
|
||||
})
|
||||
|
||||
@@ -49,7 +52,8 @@ watch(() => scanForm.format, (format) => {
|
||||
const applyIx1600Preset = () => {
|
||||
Object.assign(scanForm, {
|
||||
format: "pdf", resolution: 300, mode: "Color", source: "ADF Duplex",
|
||||
paperSize: "A4", postprocess: false, postprocessProfile: "document"
|
||||
paperSize: "A4", postprocess: false, postprocessProfile: "document",
|
||||
backgroundCleanup: true, ocr: true, ocrLanguage: "deu+eng"
|
||||
})
|
||||
}
|
||||
|
||||
@@ -83,6 +87,9 @@ const applyAgentDefaults = (agent) => {
|
||||
scanForm.source = agent.scanDefaults?.source || "ADF Duplex"
|
||||
scanForm.paperSize = agent.scanDefaults?.paperSize || "A4"
|
||||
scanForm.postprocess = Boolean(agent.scanDefaults?.postprocess)
|
||||
scanForm.backgroundCleanup = agent.scanDefaults?.backgroundCleanup !== false
|
||||
scanForm.ocr = agent.scanDefaults?.ocr !== false
|
||||
scanForm.ocrLanguage = agent.scanDefaults?.ocrLanguage || "deu+eng"
|
||||
scanForm.postprocessProfile = agent.scanDefaults?.postprocessProfile || "document"
|
||||
if (isFeederScan.value) scanForm.format = "pdf"
|
||||
|
||||
@@ -147,6 +154,11 @@ const waitForJob = async (jobId) => {
|
||||
|
||||
const startScan = async () => {
|
||||
if (!selectedAgentId.value || scanInProgress.value) return
|
||||
if ((scanForm.format === "pdf" && scanForm.ocr && !selectedAgent.value?.capabilities?.ocr) ||
|
||||
(scanForm.backgroundCleanup && !selectedAgent.value?.capabilities?.backgroundCleanup)) {
|
||||
toast.add({ title: "Agent aktualisieren", description: "Für OCR und Hintergrundbereinigung benötigt der Scanner-Rechner die aktuelle Agent-Installation mit Tesseract und OpenCV.", color: "error" })
|
||||
return
|
||||
}
|
||||
|
||||
scanInProgress.value = true
|
||||
statusMessage.value = "Scan-Auftrag wird erstellt..."
|
||||
@@ -166,6 +178,9 @@ const startScan = async () => {
|
||||
source: scanForm.source || null,
|
||||
paperSize: scanForm.paperSize,
|
||||
postprocess: scanForm.postprocess,
|
||||
backgroundCleanup: scanForm.backgroundCleanup,
|
||||
ocr: scanForm.format === "pdf" && scanForm.ocr,
|
||||
ocrLanguage: scanForm.ocrLanguage,
|
||||
postprocessProfile: scanForm.postprocessProfile
|
||||
},
|
||||
target: {
|
||||
@@ -319,10 +334,23 @@ loadAgents()
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<UCheckbox v-model="scanForm.backgroundCleanup" label="Scannerhintergrund weiß machen" :disabled="scanInProgress" />
|
||||
<p class="text-xs text-muted">Erkannte Flächen außerhalb von Bon oder Dokument werden weiß. Das Seitenformat bleibt erhalten; bei unsicheren Rändern bleibt der Scan unverändert.</p>
|
||||
<UCheckbox v-model="scanForm.ocr" label="Durchsuchbares PDF (OCR)" :disabled="scanForm.format !== 'pdf' || scanInProgress" />
|
||||
<UFormField v-if="scanForm.ocr && scanForm.format === 'pdf'" label="OCR-Sprache">
|
||||
<USelectMenu v-model="scanForm.ocrLanguage" :items="[
|
||||
{ label: 'Deutsch und Englisch', value: 'deu+eng' },
|
||||
{ label: 'Deutsch', value: 'deu' }, { label: 'Englisch', value: 'eng' }
|
||||
]" value-key="value" label-key="label" :disabled="scanInProgress" />
|
||||
</UFormField>
|
||||
<p class="text-xs text-muted">Texterkennung erfolgt vor dem Upload auf dem Scanner-Rechner, auch für normale Dateien ohne Eingangsbeleg.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-3 sm:grid-cols-[auto_minmax(0,1fr)]">
|
||||
<UCheckbox
|
||||
v-model="scanForm.postprocess"
|
||||
label="OpenCV-Korrektur"
|
||||
label="Zuschnitt und Ausrichtung zusätzlich korrigieren"
|
||||
:disabled="scanInProgress"
|
||||
/>
|
||||
<UFormField label="Profil">
|
||||
|
||||
Reference in New Issue
Block a user