Quick Start

Quick Start

This page walks through the minimum steps needed to read a OneNote .one file and export it to PDF using Aspose.Note FOSS for Python.


Prerequisites

RequirementDetail
Python3.10 or later
Packageaspose-note >= 26.3.2
OSWindows, macOS, or Linux
Microsoft OfficeNot required

Step 1 — Install

pip install aspose-note>=26.3.2

Step 2 — Load a OneNote File

Document is the root entry point. Pass a .one file path to load it:

from aspose.note import Document

doc = Document("notebook.one")
print(f"Format : {doc.FileFormat}")
print(f"Pages  : {len(list(doc))}")

Step 3 — Read Pages and Text

GetChildNodes() returns all direct descendants of a given type. Use it on Document for pages, and on each Page for rich-text leaf nodes:

from aspose.note import Document, Page, RichText

doc = Document("notebook.one")
for page in doc.GetChildNodes(Page):
    if page.Title and page.Title.TitleText:
        print(f"Page: {page.Title.TitleText}")
    for rt in page.GetChildNodes(RichText):
        text = "".join(rt)
        if text.strip():
            print(f"  {text[:120]}")

Step 4 — Export to PDF

Document.Save() with SaveFormat.Pdf produces a PDF without any external renderer:

from aspose.note import Document, SaveFormat

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

Next Steps