Пример #1
0
        internal override void SetObject(PdfItem obj)
        {
            PdfDictionary dict = (PdfDictionary)obj;

            if (PdfInternals.GetObjectID(dict).IsEmpty)
            {
                this.tbxObjectID.Text = "«direct»";
            }
            else
            {
                this.tbxObjectID.Text = PdfInternals.GetObjectID(dict).ToString();
            }
            this.txtType.Text = dict.GetType().Name;

            this.lvKeys.Items.Clear();
            this.tbxStream.Clear();
            PdfName[] keys = dict.Elements.KeyNames;
            foreach (PdfName key in keys)
            {
                bool    indirect = false;
                PdfItem tag      = null;
                PdfItem value    = dict.Elements[key];
                if (value == null)
                {
                    throw new NotImplementedException("Value is null.");
                }
                else if (value is PdfReference)
                {
                    indirect = true;
                    value    = ((PdfReference)value).Value;
                    tag      = value;
                }
                else
                {
                    if (value is PdfObject)
                    {
                        tag = value;
                    }
                }

                string address = "";
                if (indirect)
                {
                    address = /*((PdfObject)value).ObjectID.ToString() +*/ "---> ";
                }
                ListViewItem item = new ListViewItem(
                    new string[4] {
                    key.Value,
                    address + value.ToString(),
                    indirect ? PdfInternals.GetObjectID((PdfObject)value).ToString() : "",
                    value.GetType().Name
                });
                item.Tag = tag;
                this.lvKeys.Items.Add(item);
            }

            FillStreamBox();
        }