class HexaPDF::Type::Page

def index

Returns the index of the page in the page tree.
def index
  idx = 0
  node = self
  while (parent_node = node[:Parent])
    parent_node[:Kids].each do |kid|
      break if kid == node
      idx += (kid.type == :Page ? 1 : kid[:Count])
    end
    node = parent_node
  end
  idx
end