This commit is contained in:
zadam
2023-02-01 21:07:23 +01:00
parent 37ba76fdd8
commit 88e09eb279
7 changed files with 258 additions and 1229 deletions

View File

@@ -729,27 +729,12 @@ function scanForLinks(note, content) {
}
}
function runOcr(note, buffer) {
if (!note.isImage() || !optionService.getOptionBool('ocrImages')) {
return;
}
try {
const plainText = textExtractingService.ocrTextFromBuffer(buffer);
note.saveNoteAncillary('plainText', 'text/plain', plainText);
}
catch (e) {
log.error(`OCR on note '${note.noteId}' failed with error '${e.message}', stack ${e.stack}`);
}
}
/**
* Things which have to be executed after updating content, but asynchronously (separate transaction)
*/
async function asyncPostProcessContent(note, content) {
scanForLinks(note, content);
runOcr(note, content);
await textExtractingService.runOcr(note, content);
await textExtractingService.extractTextFromPdf(note, content);
}