Extracting and tagging/labeling text from pdfs I'm trying to extract paragraphs from 230 pdfs that have similar formats, and then label the paragraphs based on the pdf's section headings. Normally, I'd convert the pdf to txt files or extract the text using pdftools on R, but this would prevent me from distinguishing the text in headings -- which is bold, has a certain color -- from the text in the body that I want to &quot;tag&quot;. I have access to Adobe Acrobat Pro, so I can convert the pdfs to .txt, .xml, .html, .rtf, or .docx files.

Does anyone have any suggestions on the best way to proceed?
If there isn't a straightforward answer to the first question, is there one file format among the ones listed above (aside from .txt, which would strip the formatting) that would be easier to parse than others?

Thanks!
Since the main goal is to extract headers(which has different characteristics from other text). It would be best to convert pdf to xml as you will get features like style,hpos,vpos for each text in the file.
To work with xml you can refer ElemenTree.