Collect all child nodes of lists and tables

This commit is contained in:
Edoardo Cavazza 2025-10-02 10:53:19 +02:00
parent de7179fd74
commit 4c22b99df3

View File

@ -824,6 +824,23 @@ class StructTreePage {
const element = new StructElementNode(this, dict); const element = new StructElementNode(this, dict);
map.set(dict, element); map.set(dict, element);
switch (element.role) {
case "L":
case "LBody":
case "LI":
case "Table":
case "THead":
case "TBody":
case "TFoot":
case "TR": {
// Always collect all child nodes of lists and tables, even empty ones
for (const kid of element.kids) {
if (kid.type === StructElementType.ELEMENT) {
this.addNode(kid.dict, map, level - 1);
}
}
}
}
const parent = dict.get("P"); const parent = dict.get("P");