빠른 시작

빠른 시작

이 페이지에서는 OneNote .one 파일을 읽고 Aspose.Note FOSS를 사용하여 Python용 PDF로 내보내는 최소 단계들을 안내합니다.


전제 조건

요구 사항세부 사항
Python3.10 이상
Packageaspose-note >= 26.3.2
OSWindows, macOS 또는 Linux
Microsoft Office필요 없음

1단계 — 설치

pip install aspose-note-foss

2단계 — OneNote 파일 로드

Document은(는) 루트 진입점입니다. .one 파일 경로를 전달하여 로드합니다:

from aspose.note import Document

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

3단계 — 페이지 및 텍스트 읽기

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)

다음 단계

참조

 한국어