Introduction
Aspose.Note FOSS for Python is now available on PyPI as aspose-note: a free,
MIT-licensed library for reading and saving Microsoft OneNote files entirely in Python,
with no dependency on Microsoft Office, COM automation, or any native extension.
Install it with a single command and start loading .one files immediately:
pip install aspose-note>=26.3.2
What Is Aspose.Note FOSS for Python?
OneNote’s .one format is a proprietary binary container — parsing it without Microsoft’s
own libraries has traditionally required reverse-engineered tools or Windows-specific COM
bridges. Aspose.Note FOSS provides a pure-Python implementation that reads
the format and exports to PDF on any platform that supports Python 3.10 or later.
The library exposes a document object model: a Document root that contains Page nodes,
each of which may hold Title, Outline, RichText, Image, and AttachedFile children.
You traverse the tree with GetChildNodes(), modify nodes with AppendChildLast(), and
export the result to PDF with Document.Save().
Quick Start
from aspose.note import Document, SaveFormat
# Load a .one file
doc = Document("notebook.one")
print(f"Format: {doc.FileFormat}")
# Save to PDF
doc.Save("notebook.pdf", SaveFormat.Pdf)
print("Saved notebook.pdf")
Reading Pages and Text
Pages are Page nodes inside the Document. Each Page has a Title property and can
contain Outline elements with RichText content. Use GetChildNodes() to walk the tree:
from aspose.note import Document, Page, RichText
doc = Document("notebook.one")
for page in doc.GetChildNodes(Page):
title = page.Title
if title and title.TitleText:
print(f"Page: {title.TitleText}")
for rt in page.GetChildNodes(RichText):
text = "".join(rt)
if text.strip():
print(f" Text: {text[:80]}")
Saving to PDF
Document.Save() accepts a file path or a BytesIO stream and a SaveFormat value.
SaveFormat.Pdf converts the document to PDF without any external dependencies:
import io
from aspose.note import Document, SaveFormat
doc = Document("notebook.one")
# Save to a file
doc.Save("output.pdf", SaveFormat.Pdf)
# Save to an in-memory buffer
buf = io.BytesIO()
doc.Save(buf, SaveFormat.Pdf)
pdf_bytes = buf.getvalue()
print(f"PDF size: {len(pdf_bytes)} bytes")
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| OneNote 2010 | .one | ✓ | — |
| OneNote 2007 | .one | ✓ | — |
| OneNote Online | .one | ✓ | — |
.pdf | — | ✓ |
Open Source & Licensing
Aspose.Note FOSS for Python is released under the MIT License. The package is published
on PyPI as aspose-note and commercial use, modification, and redistribution are all
permitted under the MIT terms.