Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save documentprocessing/9976625c549c45c46e77fb2d2b80c729 to your computer and use it in GitHub Desktop.
Save documentprocessing/9976625c549c45c46e77fb2d2b80c729 to your computer and use it in GitHub Desktop.
Convert PDF files to DOCX with pdf2docx
from pdf2docx import Converter
# Specify the PDF file to convert
pdf_file = 'example.pdf'
docx_file = 'output.docx'
# Create a Converter object and convert the PDF to DOCX
cv = Converter(pdf_file)
cv.convert(docx_file, start=0, end=None)
cv.close()
print("Conversion completed! The DOCX file has been created.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment