-
Hello, |
Beta Was this translation helpful? Give feedback.
Answered by
InusualZ
Jun 19, 2021
Replies: 1 comment 1 reply
-
Hi, Here is one of the way that you can do it. var extractionPosition = new PdfRectangle(200, 300, 300, 600);
using var fileStream = File.OpenRead("test.pdf");
using var document = PdfDocument.Open(fileStream);
for (var pageIndex = 1; pageIndex <= document.NumberOfPages; ++pageIndex)
{
var page = document.GetPage(pageIndex);
var blocks = DocstrumBoundingBoxes.Instance.GetBlocks(page.GetWords(NearestNeighbourWordExtractor.Instance));
foreach (var block in blocks)
{
if (!extractionPosition.IntersectsWith(block.BoundingBox))
{
continue;
}
// Do something with the text block...
}
} This is not the only way to do it, and you can configure a lot of thing in my approach. I hope this help. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
niko86
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Here is one of the way that you can do it.
This is not the only way to do it, and you c…