import pandas import pdfquery #read the PDF pdf = pdfquery.PDFQuery('cc.pdf') pdf.load() #convert the pdf to XML pdf.tree.write('cc.xml', pretty_print = True) pdf