Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active November 20, 2022 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/fec8d42d3bdd697fbd70e041b4aca385 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/fec8d42d3bdd697fbd70e041b4aca385 to your computer and use it in GitHub Desktop.
Convert PDF Files to Word Format using Python
import aspose.words as aw
# create PDF load options
loadOptions = aw.saving.PdfLoadOptions()
loadOptions.load_format = aw.LoadFormat.PDF
# set index of the starting page and page count
loadOptions.page_index = 0
loadOptions.page_count = 1
# skip images in PDF
loadOptions.skip_pdf_images = True
# to set password for encrypted PDF files
#loadOptions.password = "12345"
# load PDF file
doc = aw.Document("PDF.pdf", loadOptions)
# convert PDF to Word
doc.save("pdf-to-word.docx")
import aspose.words as aw
# load the PDF file
doc = aw.Document("PDF.pdf")
# convert PDF to Word DOCX format
doc.save("pdf-to-word.docx")
@Nijai
Copy link

Nijai commented Nov 20, 2022

This code gives error in windows cmd => loadOptions = aw.saving.PdfLoadOptions()
AttributeError: module 'aspose.words.saving' has no attribute 'PdfLoadOptions'. Did you mean: 'PdfSaveOptions'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment