بدء سريع

بدء سريع

هذه الصفحة تتجول في الحد الأدنى من الخطوات اللازمة لقراءة OneNote .one الملف و تصديرها إلى PDF باستخدام Aspose.Note FOSS for Python.


المعايير

مطلوبالتفاصيل
Python3.10 or later
حزمةaspose-note >= 26.3.2
OSويندوز أو ماكوس أو لينكس
Microsoft Office مكتبلا مطلوب

الخطوة 1 - تثبيت

pip install aspose-note>=26.3.2

الخطوة 2 - تحميل ملف OneNote

Document هو نقطة الدخول الجذرية. pass a .one مسار الملف لتحميلها:

from aspose.note import Document

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

الخطوة الثالثة: قراءة الصفحات والنصوص

GetChildNodes() يعود جميع الأصليين المباشرين من نوع معين.استخدمه على Document على كل صفحة، وعلى كل Page لـ غنية النص الورقي:

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

الخطوة 4 - تصدير إلى PDF

Document.Save() مع SaveFormat.Pdf إنتاج PDF دون أي جهاز عرض خارجي:

from aspose.note import Document, SaveFormat

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

الخطوات التالية

 العربية