我正在使用iText重新創建Acrobat的標記樹功能。使用MCID內容獲取標記的內容
到目前爲止,我已經設法得到標籤結構。
我想弄清楚的最後一件事是如何讓&解碼內容流中標記的「標記內容」。
編輯:添加目的
這個問題的目的是要弄清楚如何訪問內容流,具有MCID和解碼的內容。
編輯2:添加iText的RUPS參考
下面的圖像顯示了我的樹已經達到,紅線指向MCID,我想獲得它的內容。
編輯3:添加構建樹
private void manipulate(PdfDictionary element, ItemCollection items)
{
if (element == null)
{
return;
}
ICollection<PdfName> val = element.KeySet();
PdfObject tagName = element.Get(PdfName.S);
PdfObject elementType = element.Get(PdfName.Type);
string tn = "";
if (tagName != null)
{
tn = ((PdfName)tagName).GetValue();
}
else
{
tn = ((PdfName)elementType).GetValue();
}
TreeViewItem tvI = new TreeViewItem() { Header = tn, IsExpanded = true };
items.Add(tvI);
PdfArray kids = element.GetAsArray(PdfName.K);
if (kids == null)
{
return;
}
for (int i = 0; i < kids.Size(); i++)
{
PdfDictionary child = kids.GetAsDictionary(i); //Code change required here to detect MCID & get content, this line returns null when child is a MCID
manipulate(child, tvI.Items);
}
}
}
編輯4當前的代碼:這樣做的原因是重新創建的Acrobat的 「變量樹」 的功能。
感謝您的建議。但我仍然想知道如何訪問內容流並對其內容進行解碼。 – PrivatMamtora
你有沒有聽說過iText RUPS? –
是的,我一直在使用它作爲一個調試工具。請參閱編輯。 – PrivatMamtora