解决繁体ocr失败的问题
This commit is contained in:
parent
aa58689e1c
commit
d731b3e1d1
|
@ -68,17 +68,17 @@ Dialog_AquireInto::Dialog_AquireInto(int fileNameStartIndex, QWidget* parent) :
|
|||
ui->spin_index->setFixedWidth(160);
|
||||
ui->cbox_digit->setFixedWidth(80);
|
||||
|
||||
bool Microteck_Vietnam = false;
|
||||
bool MicroteckOcr = false;
|
||||
#if defined (OEM_ZHONGJING) && defined (HG_CMP_MSC)
|
||||
if (1258 == lang_get_cur_code_page())
|
||||
if (1258 == lang_get_cur_code_page() || 950 == lang_get_cur_code_page())
|
||||
{
|
||||
Microteck_Vietnam = true;
|
||||
MicroteckOcr = true;
|
||||
ui->cbox_format->removeItem(11);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (x86_64) || defined (loongarch64)
|
||||
if (!Microteck_Vietnam)
|
||||
if (!MicroteckOcr)
|
||||
{
|
||||
ui->cbox_format->removeItem(11);
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ Dialog_Export::Dialog_Export(int total, const std::vector<int> &selectedIndexs,
|
|||
ui->setupUi(this);
|
||||
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
|
||||
bool Microteck_Vietnam = false;
|
||||
bool MicroteckOcr = false;
|
||||
#if defined (OEM_ZHONGJING) && defined (HG_CMP_MSC)
|
||||
if (1258 == lang_get_cur_code_page())
|
||||
if (1258 == lang_get_cur_code_page() || 950 == lang_get_cur_code_page())
|
||||
{
|
||||
Microteck_Vietnam = true;
|
||||
MicroteckOcr = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -52,7 +52,7 @@ Dialog_Export::Dialog_Export(int total, const std::vector<int> &selectedIndexs,
|
|||
|
||||
#if !defined (x86_64) && !defined (loongarch64)
|
||||
m_supportType.push_back(SupportType(".pdf", "OCR->PDF - Portable Document Format", FILE_TYPE_ATTR_THIRD_HANDLER | FILE_TYPE_ATTR_CONTAIN_MULTI_PAGES));
|
||||
if (!Microteck_Vietnam)
|
||||
if (!MicroteckOcr)
|
||||
{
|
||||
m_supportType.push_back(SupportType(".ofd", "OCR->OFD - Open Fixed-layout Document", FILE_TYPE_ATTR_THIRD_HANDLER | FILE_TYPE_ATTR_CONTAIN_MULTI_PAGES));
|
||||
m_supportType.push_back(SupportType(".rtf", "OCR->RTF - Rich Text Format", FILE_TYPE_ATTR_THIRD_HANDLER | FILE_TYPE_ATTR_CONTAIN_MULTI_PAGES));
|
||||
|
|
|
@ -130,7 +130,7 @@ HGResult Dialog_ExportImageFile::processMultiFileOcr()
|
|||
|
||||
bool useDefaultOcr = true;
|
||||
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
|
||||
if (1258 == lang_get_cur_code_page())
|
||||
if (1258 == lang_get_cur_code_page() || 950 == lang_get_cur_code_page())
|
||||
{
|
||||
HGChar tmpFileName[260];
|
||||
HGBase_GetTmpFileName("tif", tmpFileName, 260);
|
||||
|
@ -194,7 +194,13 @@ HGResult Dialog_ExportImageFile::processMultiFileOcr()
|
|||
if (HGBASE_ERR_OK == ret)
|
||||
{
|
||||
ret = HGBASE_ERR_FAIL;
|
||||
if (CreateOcrPdf(QString::fromLocal8Bit(tmpFileName), fileName, "vie"))
|
||||
QString lang("vie");
|
||||
if (950 == lang_get_cur_code_page())
|
||||
{
|
||||
lang = "chi_tra";
|
||||
}
|
||||
|
||||
if (CreateOcrPdf(QString::fromLocal8Bit(tmpFileName), fileName, lang.toStdString().c_str()))
|
||||
{
|
||||
useDefaultOcr = false;
|
||||
ret = HGBASE_ERR_OK;
|
||||
|
|
|
@ -60,11 +60,11 @@ Dialog_SaveAs::Dialog_SaveAs(bool isSaveAs, QWidget *parent) :
|
|||
}
|
||||
}
|
||||
|
||||
bool Microteck_Vietnam = false;
|
||||
bool MicroteckOcr = false;
|
||||
#if defined (OEM_ZHONGJING) && defined (HG_CMP_MSC)
|
||||
if (1258 == lang_get_cur_code_page())
|
||||
if (1258 == lang_get_cur_code_page() || 950 == lang_get_cur_code_page())
|
||||
{
|
||||
Microteck_Vietnam = true;
|
||||
MicroteckOcr = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -81,7 +81,7 @@ Dialog_SaveAs::Dialog_SaveAs(bool isSaveAs, QWidget *parent) :
|
|||
|
||||
#if !defined (x86_64) && !defined (loongarch64)
|
||||
filters.append("OCR->PDF - Portable Document Format(*.pdf)");
|
||||
if (!Microteck_Vietnam)
|
||||
if (!MicroteckOcr)
|
||||
{
|
||||
filters.append("OCR->OFD - Open Fixed-layout Document(*.ofd)");
|
||||
if (m_isSaveAs)
|
||||
|
|
|
@ -527,13 +527,19 @@ HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool
|
|||
|
||||
bool useDefaultOcr = true;
|
||||
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
|
||||
if (1258 == lang_get_cur_code_page())
|
||||
if (1258 == lang_get_cur_code_page() || 950 == lang_get_cur_code_page())
|
||||
{
|
||||
HGChar tmpFileName[260];
|
||||
HGBase_GetTmpFileName("bmp", tmpFileName, 260);
|
||||
if (HGBASE_ERR_OK == HGImgFmt_SaveImage(image, 0, NULL, tmpFileName))
|
||||
{
|
||||
if (CreateOcrPdf(QString::fromLocal8Bit(tmpFileName), QString::fromLocal8Bit(fileName), "vie"))
|
||||
QString lang("vie");
|
||||
if (950 == lang_get_cur_code_page())
|
||||
{
|
||||
lang = "chi_tra";
|
||||
}
|
||||
|
||||
if (CreateOcrPdf(QString::fromLocal8Bit(tmpFileName), QString::fromLocal8Bit(fileName), lang.toStdString().c_str()))
|
||||
{
|
||||
useDefaultOcr = false;
|
||||
ret = HGBASE_ERR_OK;
|
||||
|
@ -4437,7 +4443,14 @@ void MainWindow::ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg *msg, HGPointer p
|
|||
{
|
||||
HGChar tmpFileName[260];
|
||||
HGBase_GetTmpFileName("pdf", tmpFileName, 260);
|
||||
if (CreateOcrPdf(*filePath, QString::fromLocal8Bit(tmpFileName), "vie"))
|
||||
|
||||
QString lang("vie");
|
||||
if (950 == lang_get_cur_code_page())
|
||||
{
|
||||
lang = "chi_tra";
|
||||
}
|
||||
|
||||
if (CreateOcrPdf(*filePath, QString::fromLocal8Bit(tmpFileName), lang.toStdString().c_str()))
|
||||
{
|
||||
DeleteFileA(filePath->toLocal8Bit().toStdString().c_str());
|
||||
MoveFileA(tmpFileName, filePath->toLocal8Bit().toStdString().c_str());
|
||||
|
|
Loading…
Reference in New Issue