Learn how to convert PDF files to Word format using Python: https://blog.aspose.com/2021/10/29/convert-pdf-to-word-in-python/
Last active
November 20, 2022 12:44
-
-
Save aspose-com-gists/fec8d42d3bdd697fbd70e041b4aca385 to your computer and use it in GitHub Desktop.
Convert PDF Files to Word Format using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code gives error in windows cmd => loadOptions = aw.saving.PdfLoadOptions()
AttributeError: module 'aspose.words.saving' has no attribute 'PdfLoadOptions'. Did you mean: 'PdfSaveOptions'?