from pyPdf import PdfFileWriter, PdfFileReader

def get_pdf_title(pdf_file_path):
    with open(pdf_file_path) as f:
        pdf_reader = PdfFileReader(f)
return pdf_reader.getDocumentInfo().title
Extracting titles from PDF files?