Load / Save Options — Aspose.Note FOSS for Python API Reference
类:LoadOptions
Properties: aspose.note Properties: from aspose.note import LoadOptions
LoadOptions 被传递给 Document 构造函数,以控制如何 .one 文件被加载。.
Document(source="file.one", load_options=LoadOptions())Properties
| Properties | Properties | Properties | Properties |
|---|---|---|---|
DocumentPassword | `str | None` | None |
LoadHistory | bool | False | API 兼容性字段;在 v26.3.1 中未实际使用。. |
Properties
from aspose.note import Document, LoadOptions
opts = LoadOptions()
opts.LoadHistory = False # no-op in v26.3.1, kept for .NET API compatibility
doc = Document("MyNotes.one", opts)类:SaveOptions(基类)
Properties: aspose.note.saving Properties: from aspose.note.saving import PdfSaveOptions
SaveOptions 是所有保存选项的抽象基类。它需要一个 SaveFormat 作为其第一个位置参数。.
Properties
| Properties | Properties | Properties |
|---|---|---|
SaveFormat | SaveFormat | 目标输出格式用于 Document.Save() |
不要实例化 SaveOptions 直接。请使用其具体子类之一。.
类:PdfSaveOptions
Properties: aspose.note.saving Properties: from aspose.note.saving import PdfSaveOptions Properties: SaveOptions
PDF 专用的导出配置。这是唯一在 v26.3.1 中其选项会转发到底层导出器的保存选项类。.
使用 PdfSaveOptions() — 不需要参数。.
Properties
| Properties | Properties | Properties | 转发给导出器 | Properties |
|---|---|---|---|---|
SaveFormat | SaveFormat | SaveFormat.Pdf | — | 必须是 SaveFormat.Pdf |
PageIndex | int | 0 | Properties | 为 API 兼容性声明;在 v26.3.1 中没有任何影响。 |
PageCount | `int | None` | None | Properties |
PageIndex / PageCount 警告: 这些字段存在于 dataclass 中,但未被读取 Document.Save() 在 v26.3.1 中。所有页面始终导出为 PDF,且不受这些值的影响。.
Properties
from aspose.note import Document, SaveFormat
from aspose.note.saving import PdfSaveOptions
doc = Document("MyNotes.one")
##Basic PDF export
doc.Save("output.pdf", SaveFormat.Pdf)
##Using PdfSaveOptions
opts = PdfSaveOptions()
doc.Save("output.pdf", opts)import io
from aspose.note import Document, SaveFormat
from aspose.note.saving import PdfSaveOptions
##Export to an in-memory buffer
doc = Document("MyNotes.one")
buf = io.BytesIO()
opts = PdfSaveOptions()
doc.Save(buf, opts)
pdf_bytes = buf.getvalue()
print(f"PDF size: {len(pdf_bytes)} bytes")实现了哪些保存格式??
| Properties | Options 类 | 在 v26.3.1 中实现 |
|---|---|---|
SaveFormat.Pdf | PdfSaveOptions | 是 — 需要 pip install "aspose-note[pdf]" |
SaveFormat.One | — | 否 — 抛出 UnsupportedSaveFormatException |
另见
- Properties:
Document.Save()接受这些选项 - SaveFormat: 支持的输出格式的枚举
- UnsupportedSaveFormatException: 对未实现的格式抛出
- PDF 导出开发者指南