|
@@ -102,6 +102,18 @@ DWORD WINAPI ProcessThread(void *param)
|
|
|
std::vector<std::string> fourList;
|
|
|
AssignWordsFromTest(UnicodeToGB2312(pWnd->m_strTextPath), twoList, threeList, fourList);
|
|
|
|
|
|
+ HMODULE module = GetModuleHandle(0);
|
|
|
+ TCHAR pFileName[MAX_PATH + 2] = { 0 };
|
|
|
+ GetModuleFileName(module, pFileName, MAX_PATH);
|
|
|
+
|
|
|
+ CString csFullPath(pFileName);
|
|
|
+ int nPos = csFullPath.ReverseFind(_T('\\'));
|
|
|
+ CString strFileDir = csFullPath.Left(nPos);
|
|
|
+ CString strFilePath = strFileDir + L"\\config.ini";
|
|
|
+ WCHAR wgray[10];
|
|
|
+ GetPrivateProfileString(L"USER", L"GrayPix", L"100", wgray, 10, strFilePath);
|
|
|
+ int nLineGrayPix = _wtoi(wgray);
|
|
|
+
|
|
|
auto CovertPdfFunc = [&](std::vector<std::string>& vctFiles, int col, int& pageNum){
|
|
|
std::string strPage1;
|
|
|
for (size_t i = 0; i < vctFiles.size(); i += max_line * col)
|
|
@@ -111,7 +123,7 @@ DWORD WINAPI ProcessThread(void *param)
|
|
|
vecSmall.insert(vecSmall.begin(), vctFiles.begin() + i, vctFiles.begin() + last);
|
|
|
|
|
|
std::string strPagePath;
|
|
|
- dataCollectionPaper(col, pageNum, 30, 100, false, vecSmall, pWnd->m_strPdfDir, strPagePath);
|
|
|
+ dataCollectionPaper(col, pageNum, 30, nLineGrayPix, false, vecSmall, pWnd->m_strPdfDir, strPagePath);
|
|
|
if (strPage1.length() == 0)
|
|
|
{
|
|
|
strPage1 = strPagePath;
|
|
@@ -143,7 +155,7 @@ DWORD WINAPI ProcessThread(void *param)
|
|
|
};
|
|
|
|
|
|
|
|
|
- int pageNum = 100;
|
|
|
+ int pageNum = _wtoi(pWnd->m_strPageNumber);
|
|
|
CovertPdfFunc(twoList, 2, pageNum);
|
|
|
CovertPdfFunc(threeList, 3, pageNum);
|
|
|
CovertPdfFunc(fourList, 4, pageNum);
|
|
@@ -421,6 +433,7 @@ void CMFCApplication1Dlg::OnBnClickedOk()
|
|
|
{
|
|
|
((CEdit*)GetDlgItem(IDC_EDIT_TXT))->GetWindowText(m_strTextPath);
|
|
|
((CEdit*)GetDlgItem(IDC_EDIT_PDF))->GetWindowText(m_strPdfDir);
|
|
|
+ ((CEdit*)GetDlgItem(IDC_EDIT_PAGE_NUMBER))->GetWindowText(m_strPageNumber);
|
|
|
|
|
|
if (m_strTextPath.GetLength() == 0)
|
|
|
{
|
|
@@ -432,6 +445,22 @@ void CMFCApplication1Dlg::OnBnClickedOk()
|
|
|
AfxMessageBox(L"PDF文件夹未选择");
|
|
|
return;
|
|
|
}
|
|
|
+ m_strPageNumber.Trim();
|
|
|
+ if (m_strPageNumber.GetLength() == 0)
|
|
|
+ {
|
|
|
+ AfxMessageBox(L"启始页码未输入");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (m_strPageNumber.SpanIncluding(_T("0123456789")) != m_strPageNumber)
|
|
|
+ {
|
|
|
+ AfxMessageBox(L"启始页码不是数字");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (_wtoi(m_strPageNumber.GetBuffer()) > 20000)
|
|
|
+ {
|
|
|
+ AfxMessageBox(L"启始页码小于20000");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
GetDlgItem(IDOK)->EnableWindow(FALSE);
|
|
|
m_strMsg = "";
|