Extracting Text from a pdf paragraph wise

Hi, 
I want to extract text from a pdf page by page, paragraph wise, which includes different headings and related contents.
Then I want to store them in DB which includes two columns one is heading column and other is content column.
I used getpdftext function initially, then extract function to extract the desire contents, but did not get the expected result as the heading words are also present inside contents.
Anybody please help me out?

  Discussion posts and replies are publicly visible