本文整理汇总了C#中PdfDictionary.GetDirectObject方法的典型用法代码示例。如果您正苦于以下问题:C# PdfDictionary.GetDirectObject方法的具体用法?C# PdfDictionary.GetDirectObject怎么用?C# PdfDictionary.GetDirectObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfDictionary
的用法示例。
在下文中一共展示了PdfDictionary.GetDirectObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDictionaryDetail
/**
* Shows the detail of a dictionary.
* @param dic the dictionary of which you want the detail
* @param depth the depth of the current dictionary (for nested dictionaries)
* @return a String representation of the dictionary
*/
public static String GetDictionaryDetail(PdfDictionary dic, int depth){
StringBuilder builder = new StringBuilder();
builder.Append('(');
IList<PdfName> subDictionaries = new List<PdfName>();
foreach (PdfName key in dic.Keys) {
PdfObject val = dic.GetDirectObject(key);
if (val.IsDictionary())
subDictionaries.Add(key);
builder.Append(key);
builder.Append('=');
builder.Append(val);
builder.Append(", ");
}
builder.Length = builder.Length-2;
builder.Append(')');
foreach (PdfName pdfSubDictionaryName in subDictionaries) {
builder.Append('\n');
for (int i = 0; i < depth+1; i++){
builder.Append('\t');
}
builder.Append("Subdictionary ");
builder.Append(pdfSubDictionaryName);
builder.Append(" = ");
builder.Append(GetDictionaryDetail(dic.GetAsDict(pdfSubDictionaryName), depth+1));
}
return builder.ToString();
}
示例2: StructureObject
/**
* Creates a StructureObject for an OBJR dictionary.
* @param structElem the parent structure element
* @param ref the reference of the parent structure element
* @param dict the object reference dictionary
*/
public StructureObject(PdfDictionary structElem, PdfIndirectReference refa, PdfDictionary dict) {
this.structElem = structElem;
this.refa = refa;
this.obj = dict.GetDirectObject(PdfName.OBJ);
this.objref = dict.GetAsIndirectObject(PdfName.OBJ);
this.structParent = ((PdfDictionary) obj).GetAsNumber(PdfName.STRUCTPARENT).IntValue;
PdfIndirectReference pg = dict.GetAsIndirectObject(PdfName.PG);
if (pg == null)
pg = structElem.GetAsIndirectObject(PdfName.PG);
this.pageref = pg.Number;
}
示例3: InspectChildDictionary
/**
* If the child of a structured element is a dictionary, we inspect the
* child; we may also draw a tag.
*
* @param k
* the child dictionary to inspect
*/
virtual public void InspectChildDictionary(PdfDictionary k, bool inspectAttributes) {
if (k == null)
return;
PdfName s = k.GetAsName(PdfName.S);
if (s != null) {
String tagN = PdfName.DecodeName(s.ToString());
String tag = FixTagName(tagN);
outp.Write("<");
outp.Write(tag);
if (inspectAttributes) {
PdfDictionary a = k.GetAsDict(PdfName.A);
if (a != null) {
Dictionary<PdfName, PdfObject>.KeyCollection keys = a.Keys;
foreach (PdfName key in keys) {
outp.Write(' ');
PdfObject value = a.Get(key);
value = PdfReader.GetPdfObject(value);
outp.Write(XmlName(key));
outp.Write("=\"");
outp.Write(value.ToString());
outp.Write("\"");
}
}
}
outp.Write(">");
PdfDictionary dict = k.GetAsDict(PdfName.PG);
if (dict != null)
ParseTag(tagN, k.GetDirectObject(PdfName.K), dict);
InspectChild(k.GetDirectObject(PdfName.K));
outp.Write("</");
outp.Write(tag);
outp.WriteLine(">");
} else
InspectChild(k.GetDirectObject(PdfName.K));
}