Load / Save Options

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

PropertiesPropertiesPropertiesProperties
DocumentPassword`strNone`None
LoadHistoryboolFalseAPI 兼容性字段;在 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

PropertiesPropertiesProperties
SaveFormatSaveFormat目标输出格式用于 Document.Save()

不要实例化 SaveOptions 直接。请使用其具体子类之一。.


类:PdfSaveOptions

Properties: aspose.note.saving Properties: from aspose.note.saving import PdfSaveOptions Properties: SaveOptions

PDF 专用的导出配置。这是唯一在 v26.3.1 中其选项会转发到底层导出器的保存选项类。.

使用 PdfSaveOptions() — 不需要参数。.

Properties

PropertiesPropertiesProperties转发给导出器Properties
SaveFormatSaveFormatSaveFormat.Pdf必须是 SaveFormat.Pdf
PageIndexint0Properties为 API 兼容性声明;在 v26.3.1 中没有任何影响。
PageCount`intNone`NoneProperties

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

实现了哪些保存格式??

PropertiesOptions 类在 v26.3.1 中实现
SaveFormat.PdfPdfSaveOptions是 — 需要 pip install "aspose-note[pdf]"
SaveFormat.One否 — 抛出 UnsupportedSaveFormatException

另见

 中文