DocumentSerializerOptions Class
Definition
Shared options for all document serializers (RTF, DOCX, etc.).
public class DocumentSerializerOptions
Remarks
Replaces the former per-format RtfSerializerOptions and DocxSerializerOptions
with a single type. All serializer behavior is derived from Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.ExportMode:
- Avalonia.Controls.Documents.Serialization.DocumentExportMode.RoundTripStrict: synthetic controls + all custom markers.
- Avalonia.Controls.Documents.Serialization.DocumentExportMode.InteropSafe: native controls + custom markers for unsupported properties.
- Avalonia.Controls.Documents.Serialization.DocumentExportMode.Portable: native controls only, no custom markers.
Constructors
| Name | Description |
|---|---|
| DocumentSerializerOptions | No summary available. |
DocumentSerializerOptions Constructor
public DocumentSerializerOptions()
Properties
| Name | Description |
|---|---|
| ExportMode | Controls the export strategy for all serializers. Defaults to Avalonia.Controls.Documents.Serialization.DocumentExportMode.RoundTripStrict. |
| ImageEncodingPolicy | How images whose encoded format the target does not accept are handled. Defaults to Avalonia.Controls.Documents.Serialization.ImageEncodingPolicy.ReencodeFromPixels, which transcodes them to a format the target accepts using the built-in codec. |
| MaxImageBytes | Maximum size, in bytes, of a single embedded image. An image whose payload exceeds this limit is skipped and the surrounding document still loads. (the default) imposes no limit. Use this to guard against hostile or malformed documents with oversized image payloads. |
ExportMode Property
Controls the export strategy for all serializers. Defaults to Avalonia.Controls.Documents.Serialization.DocumentExportMode.RoundTripStrict.
public Avalonia.Controls.Documents.Serialization.DocumentExportMode ExportMode { get; set; }
ImageEncodingPolicy Property
How images whose encoded format the target does not accept are handled. Defaults to Avalonia.Controls.Documents.Serialization.ImageEncodingPolicy.ReencodeFromPixels, which transcodes them to a format the target accepts using the built-in codec.
public Avalonia.Controls.Documents.Serialization.ImageEncodingPolicy ImageEncodingPolicy { get; set; }
MaxImageBytes Property
Maximum size, in bytes, of a single embedded image. An image whose payload exceeds this limit is skipped and the surrounding document still loads. (the default) imposes no limit. Use this to guard against hostile or malformed documents with oversized image payloads.
public Nullable<long> MaxImageBytes { get; set; }
Remarks
Applies to every format that carries image bytes: on read to RTF, DOCX, XAML and HTML, and on write to PDF, where the payload measured is the sample buffer for an image that holds only pixels. Plain text and Markdown carry no embedded images - a Markdown image is always a reference the host resolves - so the limit does not reach them.