title: How do I walk through tree of Pdf Objects in PDFSharp?
body: <p>I am trying to to walk though the tree of PdfItem objects in an existing PDF document using PDFSharp in c#. </p>
  
  <p>I want to create a hierarchy of all the objects as I go along -- similar to what the "PDF Explorer" example does -- but I want it to be a tree instead of a flat list of all the objects.</p>
  
  <p>The root node is document.Internals.Catalog. And I want to to walk down through all the document.Internals.Catalog.Elements until I have visited every element.</p>
  
  <p>One of the problems I run into is that there are circular references in the tree and I can't figure out how to detect them.</p>
  
  <p>Any code samples out there?</p>