RED-9964: fix errors with images

This commit is contained in:
Kilian Schuettler 2024-09-03 16:37:48 +02:00
parent 61efb4cae9
commit befb6b1df6
3 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,7 @@ public class Page {
public TextBlock getMainBodyTextBlock() {
return textBlocksOnPage.stream()
.filter(atb -> !atb.isEmpty())
.collect(new TextBlockCollector());
}

View File

@ -84,6 +84,7 @@ public class DocumentGraphFactory {
.filter(SemanticNode::isLeaf)
.filter(node -> !node.getType().equals(NodeType.HEADER))
.filter(node -> !node.getType().equals(NodeType.FOOTER))
.filter(node -> !node.getType().equals(NodeType.IMAGE))
.map(SemanticNode::getTextBlock)
.map(TextBlock::getAtomicTextBlocks)
.flatMap(Collection::stream)

View File

@ -84,6 +84,7 @@ public class DocumentGraphMapper {
switch (entryData.getType()) {
case HEADER -> pages.forEach(page -> page.setHeader((Header) node));
case FOOTER -> pages.forEach(page -> page.setFooter((Footer) node));
case IMAGE -> pages.forEach(page -> page.getImages().add((Image) node));
default -> textBlock.getAtomicTextBlocks()
.forEach(atb -> atb.getPage().getTextBlocksOnPage().add(atb));
}