需要安装了Adobe Acrobat软件;在工程里引用acrobat控件,其中包含了adobe公司提供的接口,可对pdf进行各种操作,使用类向导将其导入。
提取文本内容需导入CAcroApp、croAVDoc、CAcroAVPageView、CAcroPDPage、CAcroPDTextSelect、CAcroHiliteList
根据坐标来提取pdf文字的代码:
public static string GetTextBycoor(string pdfInputPath, int pageNum, int x, int y, int width, int height)
{
try
{
Acrobat.CAcroPDDoc pdfDoc = null;
//Acrobat.CAcroPDPage pdfPage = null;
Acrobat.CAcroRect pdfRect = null;
//Acrobat.CAcroPoint pdfPoint = null;
//Acrobat.CAcroPDAnnot pdfPDA = null;
//Acrobat.CAcroApp pdfApp = null;
//Acrobat.