Introduction

This guide gets you from pip install to a working script in a few minutes. aspose-note is 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.

pip install aspose-note

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() and export the result to PDF with Document.Save(). For the full capability tour — including building a notebook from scratch — see Introducing Aspose.Note FOSS for Python.


Quick Start

Here is the whole workflow in five lines — load a .one file and save it straight to PDF:

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]}")

For a deeper look at reading text, images, attachments, and tables, see Reading OneNote .one Files in Python with Aspose.Note FOSS.


Saving to PDF

Once you have a loaded Document, converting it to PDF is a single call: pass a file path and SaveFormat.Pdf to Document.Save(), and the library renders the notebook to PDF in-process:

from aspose.note import Document, SaveFormat

doc = Document("notebook.one")
doc.Save("output.pdf", SaveFormat.Pdf)

For in-memory buffer output, batch conversion, and the export-only limitation, see Exporting OneNote Files to PDF in Python.


Supported Formats

FormatExtensionReadWrite
OneNote 2010.one
OneNote 2007.one
OneNote Online.one
PDF.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.


Getting Started