获取特定关键字坐标
- 获取特定关键字的坐标,联系到截图的坐标,实现自动截图(理想情况下)
- 使用spire.pdf库,实现PDF文字坐标获取
- 控制台形式
```csharp
using Spire.Pdf;
using Spire.Pdf.General.Find;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GetCoordinatesOfText
{
class Program
{
[Obsolete]
static void Main(string[] args)
{
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"D:\job\A_PDF_TEST\test\test_2.pdf");
PdfTextFind[] results = null;
foreach (PdfPageBase page in doc.Pages)
{
results = page.FindText("乐果.", TextFindParameter.WholeWord).Finds;
foreach (PdfTextFind text in results)
{
PointF p = text.Position;
Console.WriteLine(p);
}
}
Console.ReadLine();
}
}
}