1. Products
  2.   Aspose.Words
  3.   Aspose.Words FOSS for Python

Aspose.Words FOSS for Python

Export Word documents to PDF, Markdown, and plain text from Python — no Microsoft Office required.

Open-Source Python Library for Word Document Conversion

Aspose.Words FOSS for Python is a MIT-licensed Python library for loading Word documents and exporting them. It reads DOCX, DOC, RTF, TXT, and Markdown files and exports them to PDF, Markdown, and plain text without requiring Microsoft Office or any proprietary runtime. The library provides a Document class for loading files, along with dedicated LdmMarkdownWriter and LdmPdfWriter classes that write a loaded document to Markdown or PDF and accept save-options objects like PdfSaveOptions and MarkdownSaveOptions. Note: most save-options properties are defined for API forward-compatibility and are not yet consumed by the writers; only MarkdownSaveOptions.export_underline_formatting currently affects output. Install with a single pip install command. The library requires Python 3.10 or later and depends on olefile, fpdf2, and pydantic. For enterprise features and support, see Aspose.Words for Python — Enterprise Product.

Document Conversion

  • Multi-format input: Load documents from DOCX, DOC, RTF, TXT, and Markdown formats via the Document class.
  • PDF export: Export any input document to PDF using SaveFormat.PDF or PdfSaveOptions.
  • Markdown export: Export to Markdown with SaveFormat.MARKDOWN or MarkdownSaveOptions.
  • Text extraction: Extract plain text content from documents using the Document.text property.
  • Plain text export: Save documents as plain text using SaveFormat.TEXT.

Where Aspose.Words FOSS Can Be Used

  • Document pipelines: Export uploaded Word documents to PDF in backend services.
  • Content extraction: Extract text from DOCX or DOC files for indexing and search.
  • Format migration: Batch-export legacy Word archives to modern Markdown or PDF.
  • CI/CD automation: Generate PDF reports from Markdown or DOCX templates in build pipelines.

Save Options and Customization

  • PdfSaveOptions: PDF export configuration class (properties are forward-compatibility stubs; not yet applied by the writer).
  • MarkdownSaveOptions: Markdown export configuration (only export_underline_formatting is currently applied; other properties are forward-compatibility stubs).
  • SaveFormat constants: Use SaveFormat.MARKDOWN, SaveFormat.PDF, and SaveFormat.TEXT for quick conversion.
  • Document readers: Dedicated readers for DOC, RTF, TXT, and Markdown input formats.

Developer Experience

Aspose.Words FOSS installs with a single pip install command. Runtime dependencies (olefile, fpdf2, pydantic) are installed automatically.

The API is straightforward: load a Document from a file path, then write it with LdmMarkdownWriter or LdmPdfWriter. For advanced control, pass a save-options object to the writer instead of using the defaults. The library is MIT-licensed, open-source on GitHub, and requires Python 3.10 or later.

Convert DOCX to Markdown

Load a Word document and save it as Markdown.

import aspose.words_foss as aw
from aspose.words_foss.md_writer import LdmMarkdownWriter
document = aw.Document("input.docx")  # or .doc, .rtf, .txt, .md
LdmMarkdownWriter().write(document, "output.md")

Export DOCX to PDF

Export a Word document to PDF format.

import aspose.words_foss as aw
from aspose.words_foss.pdf_writer import LdmPdfWriter
document = aw.Document("input.docx")
LdmPdfWriter().write(document, "output.pdf")

Extract Text from a Document

Read all text content from a Word document.

import aspose.words_foss as aw
document = aw.Document("input.docx")
text = document.text

Frequently Asked Questions

What license does Aspose.Words FOSS for Python use?

Aspose.Words FOSS for Python is released under the MIT license. You can use, modify, and distribute it in commercial and personal projects.

How do I install Aspose.Words FOSS for Python?

Install with a single pip install command. Requires Python 3.10 or later.

Which document formats are supported?

The library reads DOCX, DOC, RTF, TXT, and Markdown files and exports to PDF, Markdown, and plain text.

How do I export a DOCX file to PDF?

Use Document("input.docx") to initialize the document object. Save as PDF with LdmPdfWriter().write(document, "output.pdf").

  

Support and Learning Resources

 English