Convert Word Documents in Python
Convert Word Documents in Python
Convert Word documents in Python with a high-performance format conversion REST API. Create, combine, integrate document conversions of any type and scale into your systems to create workflows specific to your business tasks.
Aspose document conversion platform provides maximum performance and allows converting Word, OpenOffice, PDF, HTML, Markdown, E-Mail, Postscript, plain text and other documents in any direction with top quality and high speed. With Python SDK you have 24/7 access to a full range of Document Automation and Conversion features, required by Python developers to implement their document-processing solutions.
Our Cloud SDKs are available for all major operating systems (Windows, macOS, Linux, Android), favorite programming languages (Java, C#, C++, Python, Node.js, PHP, Golang, Ruby, Swift), Java and .NET frameworks.
Supported Document Formats
Almost all mainstream document formats are supported, including DOCX, DOC, RTF, ODT, PDF, HTML, MD, XAML, TXT, PNG, JPG and many others. The complete list of supported file formats is presented in the Cloud Documentation.
Words Cloud API supports conversions of multiple documents, conversion of Word documents from the outdated DOC format to the latest DOCX and in the opposite direction.
Convert Word Documents using Python library
Aspose Cloud provides a powerful document conversion Python library, designed to convert Word documents in Python to and from Word-based formats, and also supports documents in various OpenOffice formats, E-Mail formats, PDF, HTML, Markdown, Postscript, XAML and plain text.
Convert PDF to Word in Python
Aspose Words helps you to get the most of PDF and Words documents and use them in conjunction with each other. According to your document automation tasks, you may require to convert a write-protected PDF to an editable DOCX or DOC with formatting and content identical to the original PDF.
You can easily convert PDF to DOC with our Python library. Aspose Cloud API allows converting PDF to various Word-based document formats, including DOCX, RTF and ODT.
If you need to extract text from a PDF document, just convert it to plain text with PDF to TXT conversion.
Convert Word to PDF in Python
There are several reasons why you may need to convert a Word document to PDF format. Here are some of them:
- PDF is write-protected and you can confidently share it with others.
- PDF offers better security options than a Word document.
- PDF is perfect for long-term archiving.
- PDF is optimized for professional printing.
You can easily convert Word to PDF with Python library. The output document will conform to the "PDF 1.5" or "PDF/A-1b" specification.
If you need to extract text from a Word document, just convert it to plain text with DOCX to TXT conversion.
Convert MOBI to EPUB
The increasing mainstream prominence of electronic books gives rise to a number of lightweight eBook formats, where MOBI and EPUB are the most popular. They are cross-platform and provide reflowable content. Like HTML they can adjust page representation in accordance with characteristics of the specific e-reader.
With Python SDK you can easily convert MOBI to EPUB format. EPUB has greater support across all platforms, whereas MOBI is mainly an Amazon Kindle e-reader format.
Try our free online MOBI to EPUB eBook Converter.
Convert MOBI to PDF
PDF is also widely accepted as an eBook format. With Python SDK you can convert eBook from MOBI format to more versatile PDF with ease.
Also, have a look at our online MOBI to PDF Converter. It is 100% free.
Convert Word to EPUB in Python
With Python SDK you can convert DOCX to EPUB, which is a widespread electronic book format. The original document content, formatting, images, hyperlinks and navigation would be fully compatible and operational in any electronic book reader.
Convert Word to Image in Python
There is no built-in option in Microsoft Office to save a Word document as a set of images. Using Aspose Python library you can easily convert DOCX to JPG, DOCX to PNG or any other image format.
Conversion supports both raster (JPG, GIF, PNG, etc.) and vector image formats (SVG, EMF, etc.).
Convert Word to HTML in Python
Python SDK provides an easy way to instantly convert Word document into perfect Web documents. Easily convert DOCX to HTML, Markdown, MHTML and other popular Web formats.
Getting Started with Python library
- Go through our guide to convert a document to get you started in no time.
- Check out our GitHub repository for a complete API list along with working examples.
- Try our free online Converter.
How to Convert a DOCX in Python
- Go to the Aspose Cloud Dashboard.
- Create a new Account to access all applications and services or Sign In to your account.
- Click on Applications in the left menu to get Client Id and Client Secret.
- Check API Reference page for the description of APIs parameters.
- Install Python SDK.
- Check Developer Guide to convert DOCX to PDF, EPUB, JPG, etc.
import asposewordscloud from asposewordscloud.models.requests import ConvertDocumentRequest, SaveAsRequest from asposewordscloud import SaveOptionsData, HtmlFixedSaveOptionsData app_sid = '####-####-####-####-####' app_key = '##################' words_api = WordsApi(app_sid, app_key) # Convert PDF to Word with open('sample.pdf', 'rb') as f: request = ConvertDocumentRequest(f, format='docx') result = words_api.convert_document(request) # Convert DOCX to PDF if we have a document in the Storage save_options = SaveOptionsData(file_name="dest.pdf", save_format='pdf') request = SaveAsRequest('source.docx', save_options) words_api.save_as(request) # Convert DOCX to HTML with advanced options save_options = HtmlFixedSaveOptionsData(export_embedded_css=True, css_class_names_prefix='aspose_', page_index=2, page_count=3, jpeg_quality=90, file_name='sample.html', save_format="html") request = SaveAsRequest('sample.docx', save_options) print(words_api.save_as(request))