读取PDF的文字--zt

 

1.下载PDFBox 0.7.3   sourceforge.net/project/showfiles.php

2.复制并加载如下5个DLL文件到bin目录下面

  • IKVM.GNU.Classpath.dll
  • PDFBox-0.7.3.dll
  • FontBox-0.1.0-dev.dll
  • IKVM.Runtime.dll
  • bcprov-jdk14-132.dll
  • using System;
    using org.pdfbox.pdmodel;
    using org.pdfbox.util;
    namespace PDFReader
    {
        class Program
        {
            static void Main(string[] args)
            {
                PDDocument doc = PDDocument.load("lopreacamasa.pdf");
                PDFTextStripper pdfStripper = new PDFTextStripper();
                Console.Write(pdfStripper.getText(doc));
            }
        }
    }
    

  • posted @ 2011-01-28 09:17  Nina  阅读(624)  评论(0编辑  收藏  举报