Fix grouping textlines when bounding box of parent container is wrong #386
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.
Pull request
Currently,
LTLayoutContainer.group_textlines()
searches for neighboring text lines within the bounding box of the parent container. If the bounding box of the parent container is wrong, and some of the text lines are outside it, no neighbours are found. Currently, theLTLayoutContainer.group_textlines()
skips the text lines where no neighbours are found. Consequently, the content of these lines never appear in the output.While the PDF is to blame in these cases, we can be more resilient to errorneous PDF's. In this case we should not drop the text line when no neighbouring lines are found. Instead, the line should be returned in its own LTTextBox.
Fixes #381
How Has This Been Tested?
Tested with errorneous PDF from #381. Added unittest for this edge case.
Checklist
works
version
is not necessary
verified that this is not necessary
CHANGELOG.md