Skip to main content

PdfSerializerOptions Class

Definition​

Assembly:Avalonia.Controls.Documents.Serialization.Pdf
Package:Avalonia.Controls.Documents.Serialization.Pdf

Options controlling PDF export.

public class PdfSerializerOptions

Inheritance: object -> PdfSerializerOptions

Constructors​

NameDescription
PdfSerializerOptionsNo summary available.

PdfSerializerOptions Constructor​

public PdfSerializerOptions()

Properties​

NameDescription
AuthorDocument author written to the PDF metadata.
DeterministicProduces byte-stable output: a fixed creation date and file identifier are written instead of the current time and a random identifier. Intended for tests and reproducible pipelines.
DiagnosticsReceives one Avalonia.Controls.Documents.Serialization.Pdf.PdfDiagnostic per fidelity loss the export decided to accept rather than fail on - a font left unembedded because the options or its licence forbid it, a color or variable font that no viewer can reproduce. Export never throws for these, so this callback is the only signal that the produced file is not a faithful copy of the document.
DocumentShared serializer options common to all document serializers. PDF export reads Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.MaxImageBytes and Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.ImageEncodingPolicy from it; an image the two rule out is left out of the file with its layout box kept, so the page still breaks where the screen does. Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.ExportMode has no effect here - it selects between round-trip markers and native constructs, and PDF is not a format this library reads back.
FontEmbeddingHow fonts are embedded into the produced PDF.
KeywordsDocument keywords written to the PDF metadata.
LanguageDocument language (BCP 47, e.g. en-US) written as the PDF catalog language.
MarginsPage margins in device-independent pixels. When , the document's PagePadding is used, falling back to 2 cm on every side.
PageSizePage size in device-independent pixels (1/96 inch). When , the document-declared page size is used (fixed PageWidth/PageHeight), falling back to A4 for any dimension the document does not fix.
SubjectDocument subject written to the PDF metadata.
TitleDocument title written to the PDF metadata.

Author Property​

Document author written to the PDF metadata.

public string Author { get; set; }

Deterministic Property​

Produces byte-stable output: a fixed creation date and file identifier are written instead of the current time and a random identifier. Intended for tests and reproducible pipelines.

public bool Deterministic { get; set; }

Diagnostics Property​

Receives one Avalonia.Controls.Documents.Serialization.Pdf.PdfDiagnostic per fidelity loss the export decided to accept rather than fail on - a font left unembedded because the options or its licence forbid it, a color or variable font that no viewer can reproduce. Export never throws for these, so this callback is the only signal that the produced file is not a faithful copy of the document.

public Action<Avalonia.Controls.Documents.Serialization.Pdf.PdfDiagnostic> Diagnostics { get; set; }

Remarks​

Invoked on the thread running the export, before any bytes reach the target stream. Leave it to skip the checks entirely.

Document Property​

Shared serializer options common to all document serializers. PDF export reads Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.MaxImageBytes and Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.ImageEncodingPolicy from it; an image the two rule out is left out of the file with its layout box kept, so the page still breaks where the screen does. Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.ExportMode has no effect here - it selects between round-trip markers and native constructs, and PDF is not a format this library reads back.

public Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions Document { get; set; }

FontEmbedding Property​

How fonts are embedded into the produced PDF.

public Avalonia.Controls.Documents.Serialization.Pdf.PdfFontEmbedding FontEmbedding { get; set; }

Keywords Property​

Document keywords written to the PDF metadata.

public string Keywords { get; set; }

Language Property​

Document language (BCP 47, e.g. en-US) written as the PDF catalog language.

public string Language { get; set; }

Margins Property​

Page margins in device-independent pixels. When , the document's PagePadding is used, falling back to 2 cm on every side.

public Nullable<Avalonia.Thickness> Margins { get; set; }

PageSize Property​

Page size in device-independent pixels (1/96 inch). When , the document-declared page size is used (fixed PageWidth/PageHeight), falling back to A4 for any dimension the document does not fix.

public Nullable<Avalonia.Size> PageSize { get; set; }

Subject Property​

Document subject written to the PDF metadata.

public string Subject { get; set; }

Title Property​

Document title written to the PDF metadata.

public string Title { get; set; }