使用Itext获取pdf文字的坐标

using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestIText
{
    class Program
    {
        static void Main(string[] args)
        {
           PdfReader readerTemp = new PdfReader(@"D:\_Number position.pdf");

            PdfHelper.LocationTextExtractionStrategyEx pz = new PdfHelper.LocationTextExtractionStrategyEx();

            iTextSharp.text.pdf.parser.PdfReaderContentParser p = new iTextSharp.text.pdf.parser.PdfReaderContentParser(readerTemp);
            p.ProcessContent<PdfHelper.LocationTextExtractionStrategyEx>(1, pz);

            Console.WriteLine(pz.GetResultantText());
            Console.ReadLine();


        }
    }
}

 

文章来自:http://www.cnblogs.com/YzpJason/p/7209186.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3