PDG in Word umwandeln

import textract
import docx

def pdf_to_word(pdf_file, output_file):
# Den Text aus der PDF-Datei extrahieren
text = textract.process(pdf_file)

# Ein neues Word-Dokument erstellen
document = docx.Document()

# Den Text dem Dokument hinzufügen
document.add_paragraph(text)

# Das Word-Dokument speichern
document.save(output_file)

# Die PDF-Datei in ein Word-Dokument umwandeln
pdf_to_word(‘input.pdf’, ‘output.docx’)