Aspose.Words for Python

26.4.0 · active · verified Sun Apr 12

Aspose.Words for Python is a powerful document processing library that enables developers to create, modify, convert, and render documents in various popular formats (DOCX, PDF, HTML, etc.) without requiring Microsoft Office. It's built via .NET and provides comprehensive API for working with document elements. The current version is 26.4.0, and it follows a monthly release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a new Word document, add text using a DocumentBuilder, and save it in both DOCX and PDF formats. Remember that without a valid license, trial limitations like watermarks will be applied.

import aspose.words as aw

# Create a new document
doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Add some text to the document
builder.writeln("Hello, Aspose.Words for Python!")
builder.writeln("This is a quick start example.")

# Save the document as DOCX
output_docx_path = "output.docx"
doc.save(output_docx_path)

# Save the document as PDF
output_pdf_path = "output.pdf"
doc.save(output_pdf_path)

print(f"Document saved to {output_docx_path} and {output_pdf_path}")

# Note: Without a license, documents saved will contain an Aspose watermark
# and other trial limitations.

view raw JSON →