public void OnNewDocument() { this.process = this.mainForm.Process; PdfObject[] objects = this.process.Document.Internals.GetAllObjects(); this.lvObjects.Items.Clear(); for (int idx = 0; idx < objects.Length; idx++) { PdfObject obj = objects[idx]; ListViewItem item = new ListViewItem(new string[2] { PdfInternals.GetObjectID(obj).ToString(), ExplorerProcess.GetTypeName(obj) }); item.Tag = obj; this.lvObjects.Items.Add(item); } PdfPages pages = this.process.Document.Pages; this.lvPages.Items.Clear(); for (int idx = 0; idx < pages.Count; idx++) { PdfPage page = pages[idx]; ListViewItem item = new ListViewItem(new string[2] { (idx + 1).ToString(), ExplorerHelper.PageSize(page, this.mainForm.Process.IsMetric) }); //String.Format("{0:0} x {1:0} mm", XUnit.FromPoint(page.Width).Millimeter,XUnit.FromPoint(page.Height).Millimeter)}); item.Tag = page; this.lvPages.Items.Add(item); } this.process.Navigator.SetNext(this.process.Document.Info); ActivatePage("Info"); }
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(); }
internal override void SetObject(PdfItem obj) { PdfArray array = (PdfArray)obj; if (PdfInternals.GetObjectID(array).IsEmpty) { this.tbxObjectID.Text = "«direct»"; } else { this.tbxObjectID.Text = PdfInternals.GetObjectID(array).ToString(); } this.txtType.Text = array.GetType().Name; this.lvItems.Items.Clear(); PdfItem[] items = array.Elements.Items; int count = items.Length; for (int idx = 0; idx < count; idx++) { bool indirect = false; PdfItem tag = null; PdfItem value = items[idx]; 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] { idx.ToString(), address + value.ToString(), indirect ? PdfInternals.GetObjectID((PdfObject)value).ToString() : "", value.GetType().Name }); item.Tag = tag; this.lvItems.Items.Add(item); } }
internal override void SetObject(PdfItem value) { PdfObject obj = (PdfObject)value; this.tbxObjectID.Text = PdfInternals.GetObjectID(obj).ToString(); this.txtType.Text = obj.GetType().Name; this.lvKeys.Items.Clear(); ListViewItem item = new ListViewItem( new string[3] { ExplorerProcess.GetTypeName(obj), value.ToString(), value.GetType().Name }); this.lvKeys.Items.Add(item); }