PdfSaveOptions — Aspose.Note FOSS Python API Reference

Class: PdfSaveOptions

Package: aspose.note.saving Import: from aspose.note.saving import PdfSaveOptions Inherits: SaveOptions

PdfSaveOptions provides PDF-specific export configuration for Document.Save(). All constructor arguments are keyword-only; the constructor takes no positional arguments.


Constructor

opts = PdfSaveOptions(
    *,
    PageIndex: int = 0,
    PageCount: int | None = None,
    FontsSubsystem: Any | None = None,
    ImageCompression: Any | None = None,
    JpegQuality: int | None = None,
    PageSettings: Any | None = None,
    PageSplittingAlgorithm: Any | None = None,
)

Correct usage:

from aspose.note.saving import PdfSaveOptions

opts = PdfSaveOptions()                       # all defaults
opts_quality = PdfSaveOptions(JpegQuality=85) # JPEG quality override

Incorrect (raises TypeError):

# Do NOT pass SaveFormat as a positional or keyword argument:
opts = PdfSaveOptions(SaveFormat.Pdf)   # TypeError
opts = PdfSaveOptions(SaveFormat=SaveFormat.Pdf)  # TypeError

The SaveFormat is fixed to SaveFormat.Pdf internally and cannot be overridden.


Properties

All properties are read/write unless noted.

Inherited from SaveOptions

PropertyTypeDefaultDescription
SaveFormatSaveFormatSaveFormat.PdfAlways SaveFormat.Pdf for this class. Read-only.
PageIndexint0Zero-based index of the first page to export. Not forwarded to the PDF exporter in v26.3.1; has no effect.
PageCountint | NoneNoneNumber of pages to export. Not forwarded to the PDF exporter in v26.3.1; has no effect.
FontsSubsystemAny | NoneNoneFont substitution configuration. Not used in the current PDF renderer.

PdfSaveOptions-specific

PropertyTypeDefaultDescription
ImageCompressionAny | NoneNoneImage compression setting for embedded images in the PDF output.
JpegQualityint | NoneNoneJPEG quality (0–100) for compressed image embedding. None uses the renderer default.
PageSettingsAny | NoneNonePer-page size and orientation settings.
PageSplittingAlgorithmAny | NoneNoneAlgorithm used to split content that does not fit on a single page.

Usage Examples

Basic export to file

from aspose.note import Document, SaveFormat

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

Export with PdfSaveOptions

from aspose.note import Document
from aspose.note.saving import PdfSaveOptions

doc = Document("MyNotes.one")
opts = PdfSaveOptions()
doc.Save("output.pdf", opts)

Export to an in-memory stream

import io
from aspose.note import Document
from aspose.note.saving import PdfSaveOptions

doc = Document("MyNotes.one")
buf = io.BytesIO()
doc.Save(buf, PdfSaveOptions())
pdf_bytes = buf.getvalue()
print(f"PDF size: {len(pdf_bytes)} bytes")

Set JPEG quality

from aspose.note import Document
from aspose.note.saving import PdfSaveOptions

doc = Document("MyNotes.one")
opts = PdfSaveOptions(JpegQuality=85)
doc.Save("output.pdf", opts)

Notes

  • PageIndex and PageCount are declared on PdfSaveOptions for API compatibility with Aspose.Note for .NET, but the Document.Save() implementation in v26.3.1 does not read or forward them to the PDF exporter. The entire document is always exported regardless of these values.
  • PDF export requires the optional ReportLab dependency. Install it with pip install "aspose-note[pdf]". Without ReportLab, calling Document.Save() with a PDF target raises an ImportError.

See Also