Fix #133 Marked content extraction issue

This commit is contained in:
BobLd
2020-02-09 15:23:55 +00:00
parent f05101ad07
commit 635693f032
3 changed files with 6 additions and 4 deletions

View File

@@ -109,7 +109,7 @@
/// <inheritdoc />
public override string ToString()
{
return $"Index={Index}, MCID={MarkedContentIdentifier}, Tag={Tag}, Properties={Properties}, Contents={Children.Count}";
return $"Id={Index}, MCID={MarkedContentIdentifier}, Tag={Tag}, Properties={Properties}, Children={Children.Count}";
}
}
}

View File

@@ -552,7 +552,8 @@
{
if (markedContentStack.CanPop)
{
markedContents.Add(markedContentStack.Pop(pdfScanner));
var mc = markedContentStack.Pop(pdfScanner);
if (mc != null) markedContents.Add(mc);
}
}

View File

@@ -16,14 +16,14 @@
{
private readonly Stack<MarkedContentElementActiveBuilder> builderStack = new Stack<MarkedContentElementActiveBuilder>();
private int number;
private int number = -1;
private MarkedContentElementActiveBuilder top;
public bool CanPop => top != null;
public void Push(NameToken name, DictionaryToken properties)
{
if (builderStack.Count > 0)
if (builderStack.Count == 0) // only increase index if root
{
number++;
}
@@ -42,6 +42,7 @@
{
top = builderStack.Peek();
top.Children.Add(result);
return null; // do not return child
}
else
{