From 05c0b539b4ab97b02871fa84b0fb756b522e8a89 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Fri, 17 Feb 2023 11:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=AD=E6=99=B6=E5=AF=BC?= =?UTF-8?q?=E5=87=BAocr=E9=94=99=E8=AF=AF=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner/dialog_exportimagefile.cpp | 6 +++++- app/scanner/mainwindow.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/scanner/dialog_exportimagefile.cpp b/app/scanner/dialog_exportimagefile.cpp index 950393d7..34dfdc18 100644 --- a/app/scanner/dialog_exportimagefile.cpp +++ b/app/scanner/dialog_exportimagefile.cpp @@ -116,8 +116,12 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param) HGImgFmt_CloseImageWriter(writer); - createOcrPdf(tmpFileName, getStdString(fileName).c_str()); + bool result = createOcrPdf(tmpFileName, getStdString(fileName).c_str()); QFile::remove(tmpFileName); + if (!result) + { + ret = HGIMGPROC_ERR_OCR; + } #else HGOCRMgr ocrMgr = nullptr; ret = HGImgProc_CreateOCRMgr(0, &ocrMgr); diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index a605b573..f1bb9451 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -433,9 +433,9 @@ HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool HGChar tmpFileName[256]; HGBase_GetTmpFileName("bmp", tmpFileName, 256); ret = HGImgFmt_SaveImage(image, 0, info, tmpFileName); - createOcrPdf(tmpFileName, fileName); + bool result = createOcrPdf(tmpFileName, fileName); QFile::remove(tmpFileName); - return ret; + return (result) ? HGBASE_ERR_OK : HGIMGPROC_ERR_OCR; #else // 韫囩晫鏆恑nfo HGOCRMgr ocrMgr = nullptr;