Read Pdf file in Hierarchical order

Hi,

I want to read pdf file in hierarchical order so that can iterate through it and fetch the content according to the hierarchy. There is DOM API but it’s for creating pdf. Is there something similar for reading existing document also.Like Document-> Sections-> Pages-> Paragraphs-> Text

So that can read according to the hierarchical order and create exact matching document with modification required by application without affecting layout, formatting etc.

Thanks,
Mehul