mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Fix #133 Marked content extraction issue
This commit is contained in:
@@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +552,8 @@
|
||||
{
|
||||
if (markedContentStack.CanPop)
|
||||
{
|
||||
markedContents.Add(markedContentStack.Pop(pdfScanner));
|
||||
var mc = markedContentStack.Pop(pdfScanner);
|
||||
if (mc != null) markedContents.Add(mc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user