New Feature: extract coordinates of matched text #1442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Description of the new Feature
Refactored
PdfContentStreamHandlerto abstract class so thatContentOperatorinterface is more flexible to use.Implemented a new
PdfContentStreamHandler:PdfContentTextLocatorto find and locate the bounding box coordinates of a matched regex text inside a page.Basic implementation logic searches inside a
PdfStringand uses each glyph to properly calculate the width.Possible improvement
Use the same logic provided in
renderTextto search across multiplePdfStringin the same line, even though i'm skeptical about the possible unwanted behaviours, given that we are doing a string matching on a printable format.E.g. two
PdfStringcould be on the same line but of two different paragraphs or inserted in a different order, like in the pdf document attached below.example_file.pdf
Your real name
Alessandro Ragusi