2013-05-03 91 views
1

我正在使用PDFSharp。我需要幫助。我需要檢查文檔是否包含「abc」字樣。例如:使用PDFSharp查找PDF中的單詞

11abcee = true 
444abcggw = true 
778ab = false 

我寫了這個代碼,但預期它不工作:

PdfDocument document = PdfReader.Open("c:\\abc.pdf"); 
    PdfDictionary dictionary = new PdfDictionary(document); 

    string a = dictionary.Elements.GetString("MTZ"); 

    if (a.Equals("MTZ")) 
    { 
     MessageBox.Show("OK", ""); 
    } 
    else 
    { 
     MessageBox.Show("NO", ""); 
    } 

我缺少的東西?

+0

_it's does work._所以,這不是很好嗎? – 2013-05-03 14:49:35

+0

對不起,不起作用 – Pedro 2013-05-03 14:53:58

+0

我用過[iTextSharp](http://sourceforge.net/projects/itextsharp/)。有用。 – 2013-05-03 14:54:15

回答