Find a word in PDF using PDFSharp

老子叫甜甜 提交于 2019-12-11 05:37:21

问题


I am using PDFSharp. I need help. I need to check wether the document contains the word "abc". Example:

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

I wrote this code, but it does not work as expected:

    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", "");
    }

Am I missing something?


回答1:


maybe this SO entry will help you: PDFSharp alter Text repositioning. It links to here - text extraction example with PDFSharp.



来源:https://stackoverflow.com/questions/16361730/find-a-word-in-pdf-using-pdfsharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!