A simple, fast solution for creating Word (.docx), Excel (.xlsx), PowerPoint (.pptx), and PDF documents from Python using the Syncfusion .NET Document SDK.
Microsoft Office is not required. All document processing runs locally.
Ensure the following prerequisites are installed:
- .NET 10.0 LTS SDK
- Python 3.9+
- Syncfusion .NET Document SDK packages:
Syncfusion.DocIORenderer.Net.CoreSyncfusion.XlsIORenderer.Net.CoreSyncfusion.PresentationRenderer.Net.CoreSyncfusion.Pdf.Net.Core
Choose either approach based on your needs:
| Approach | Folder | Best For | Python Packages |
|---|---|---|---|
| Approach 1: Local .NET Worker | local-dotnet-worker/ |
Subprocess isolation, CLI workflows | Zero pip packages |
| Approach 2: Python.NET Wrapper | pythonnet-wrapper/ |
In-process execution, high-performance loops | pip install pythonnet (if not installed) |
-
Navigate and publish the .NET worker:
cd local-dotnet-worker dotnet publish DocumentBridge/DocumentBridge.csproj -c Release -r win-x64 --self-contained false -o artifacts
-
Generate documents via CLI:
python document_sdk.py create-docx python document_sdk.py create-pdf
-
Run samples:
python -m samples.01_hello_world python -m samples.02_batch_invoices python -m samples.04_excel_to_pdf python -m samples.05_powerpoint_to_pdf python -m samples.06_watermark_pdf
-
Navigate and publish the class library:
cd pythonnet-wrapper dotnet publish DocumentBridge/DocumentBridge.csproj -c Release -r win-x64 --self-contained false -o artifacts
-
Install pythonnet (only if not already installed):
pip install pythonnet
(Skip this step if
pythonnetis already installed in your Python environment). -
Generate documents via CLI:
python document_sdk.py create-docx python document_sdk.py create-pdf
-
Run samples:
python -m samples.01_hello_world python -m samples.02_batch_invoices python -m samples.04_excel_to_pdf python -m samples.05_powerpoint_to_pdf python -m samples.06_watermark_pdf
Platform Note: If running on non-Windows platforms, replace
-r win-x64with-r linux-x64,-r osx-arm64, or-r osx-x64.
Both approaches include the same self-contained samples:
| Sample | Description |
|---|---|
01_hello_world.py |
Create a Word document and direct PDF |
02_batch_invoices.py |
Generate multiple documents in a loop |
03_custom_output_paths.py |
Specify custom output and bundle paths |
04_excel_to_pdf.py |
Convert an Excel workbook to PDF |
05_powerpoint_to_pdf.py |
Convert a PowerPoint presentation to PDF |
06_watermark_pdf.py |
Apply a text watermark to PDF pages |