05-02-2012، 12:45 PM
(آخرین تغییر در ارسال: 05-02-2012، 12:46 PM توسط Amin_Mansouri.)
میتونید با سورس زیر به راحتی داخل فایل پی دی اف داخل استرینگ ها یا همان رشته های فایل پی دی اف جست و جو کنید قل از استفاده نیاز به Adobe Acrobat Professional دارید یعنی باید رو سیستمتون نصب باشه
English:
This module is used to search a string in a PDF file and it will produce a text file with page number where the search string is present. To run this module Adobe Professional is required.
English:
This module is used to search a string in a PDF file and it will produce a text file with page number where the search string is present. To run this module Adobe Professional is required.
کد:
using Acrobat;
using AFORMAUTLib;
private void pdfRandD(string fPath)
{
AcroPDDocClass objPages = new AcroPDDocClass();
objPages.Open(fPath);
long TotalPDFPages = objPages.GetNumPages();
objPages.Close();
AcroAVDocClass avDoc = new AcroAVDocClass();
avDoc.Open(fPath, "Title");
IAFormApp formApp = new AFormAppClass();
IFields myFields = (IFields)formApp.Fields;
string searchWord = "Search String";
string k = "";
StreamWriter sw = new StreamWriter(@"D:\KCG_FileChecker_Inputs\MAC\pdf\0230_525490_23_cha17.txt", false);
for (int p = 0; p < TotalPDFPages; p++)
{
int numWords = int.Parse(myFields.ExecuteThisJavascript("event.value=this.getPageNumWords(" + p + ");"));
k = "";
for (int i = 0; i < numWords; i++)
{
string chkWord = myFields.ExecuteThisJavascript("event.value=this.getPageNthWord(" + p + "," + i + ", true);");
k = k + " " + chkWord;
}
if(k.Trim().Contains(searchWord))
{
int pNum = int.Parse(myFields.ExecuteThisJavascript("event.value=this.getPageLabel(" + p + ",true);"));
sw.WriteLine("The Word " + searchWord + " is exists in " + pNum);
}
}
sw.Close();
MessageBox.Show("Process completed");
}
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg