2013-05-03 86 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

回答