Hızlı Başlangıç

Hızlı Başlangıç

Bu sayfa OneNote’u okumak için gerekli minimum adımları geçer. .one Dosya ve Aspose.Note FOSS için Python’a PDF’ye ihraç edin.


Prerequisites

RequirementDetail
Python3.10 or later
Packageaspose-note >= 26.3.2
OSWindows, MacOS veya Linux
Microsoft Office içinİhtiyaç yok

Adım 1 - Yükleme

pip install aspose-note>=26.3.2

Adım 2 - OneNote Dosyası Yükleme

Document Yönlendirme noktasıdır. a .one Dosya Yolu yüklemek için:

from aspose.note import Document

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

Adım 3 - Sayfa ve Yazı Okuyun

GetChildNodes() Tüm doğrudan bir türün soyundan gelenleri geri getirir. Document sayfalar için ve her birinde Page zengin metin yaprak düğümleri için:

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

Adım 4 - PDF’ye ihraç etmek

Document.Save() ile SaveFormat.Pdf PDF’yi herhangi bir dış render olmadan üretir:

from aspose.note import Document, SaveFormat

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

Sonraki adımlar

See Also

 Türkçe