Document outline and text extraction