22-11-2012, 13:26
|
|
|
חבר מתאריך: 22.11.12
הודעות: 1
|
|
חיפוש בקבצים בc#
ניסיתי להשתמש בקוד הבא:
// Create Bytescout.PDFExtractor.TextExtractor instance
TextExtractor extractor =new TextExtractor ();
extractor .RegistrationName="demo";
extractor .RegistrationKey="demo"; // Load sample PDF document extractor .LoadDocumentFromFile("sample1.pdf");
int pageCount = extractor .GetPageCount();
RectangleF location ;
for(int i =0; i < pageCount ; i ++) { // Search each page for "ipsum" string
if(extractor .Find(i, "ipsum", false, out location )) {
do {
Console .WriteLine("Found on page "+ i +" at location "+ location .ToString()); }
while(extractor .FindNext(out location )); } }
בעת הרצת התוכנית לחיפוש בקובץ PDF שמכיל יותר מעמוד אחד
הפונקציה 'find' מציגה את הערת אזהרה הבאה:
: 'Index was outside the bounds of the array.'
מישהו יודע מה הבעיה?
מה לא נכון?
תודה מראש
Bcc
|