Skip to main content

PageSizes Class

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Well-known paper sizes and page-unit conversions, in device-independent pixels (1/96 inch) — the unit every page property in this library speaks. Assign a named size to Avalonia.Controls.FlowDocumentPageViewer.PageSize (or the editor's page-layout properties), feed its components to Avalonia.Controls.Documents.FlowDocument.PageWidth and Avalonia.Controls.Documents.FlowDocument.PageHeight, or use the conversions for margins: PagePadding = new Thickness(PageSizes.Inches(0.75)).

public class PageSizes

Inheritance: object -> PageSizes

Remarks​

Named sizes are portrait; Avalonia.Controls.Documents.PageSizes.Landscape(Avalonia.Size) turns one on its side. Note the unit trap these names exist to avoid: PDF and print software often quote paper in points (1/72 inch) — US Letter is 612 × 792 points but 816 × 1056 device-independent pixels.

Methods​

NameDescription
FromInchesA page size given in inches, as device-independent pixels.
FromMillimetersA page size given in millimeters, as device-independent pixels.
InchesConverts a length in inches to device-independent pixels.
LandscapeThe size in landscape orientation: the longer edge becomes the width. A size that is already landscape is returned unchanged.
MillimetersConverts a length in millimeters to device-independent pixels.
PortraitThe size in portrait orientation: the longer edge becomes the height. A size that is already portrait is returned unchanged.

FromInches Method​

A page size given in inches, as device-independent pixels.

public Avalonia.Size FromInches(double width, double height)

Parameters​

width double

height double

Returns​

Avalonia.Size

FromMillimeters Method​

A page size given in millimeters, as device-independent pixels.

public Avalonia.Size FromMillimeters(double width, double height)

Parameters​

width double

height double

Returns​

Avalonia.Size

Inches Method​

Converts a length in inches to device-independent pixels.

public double Inches(double inches)

Parameters​

inches double

Returns​

double

Landscape Method​

The size in landscape orientation: the longer edge becomes the width. A size that is already landscape is returned unchanged.

public Avalonia.Size Landscape(Avalonia.Size size)

Parameters​

size Avalonia.Size

Returns​

Avalonia.Size

Millimeters Method​

Converts a length in millimeters to device-independent pixels.

public double Millimeters(double millimeters)

Parameters​

millimeters double

Returns​

double

Portrait Method​

The size in portrait orientation: the longer edge becomes the height. A size that is already portrait is returned unchanged.

public Avalonia.Size Portrait(Avalonia.Size size)

Parameters​

size Avalonia.Size

Returns​

Avalonia.Size

Properties​

NameDescription
A3ISO A3: 297 × 420 mm.
A4ISO A4: 210 × 297 mm.
A5ISO A5: 148 × 210 mm.
LegalUS Legal: 8.5 × 14 inches.
LetterUS Letter: 8.5 × 11 inches.
TabloidUS Tabloid (Ledger upright): 11 × 17 inches.

A3 Property​

ISO A3: 297 × 420 mm.

public Avalonia.Size A3 { get; set; }

A4 Property​

ISO A4: 210 × 297 mm.

public Avalonia.Size A4 { get; set; }

A5 Property​

ISO A5: 148 × 210 mm.

public Avalonia.Size A5 { get; set; }

US Legal: 8.5 × 14 inches.

public Avalonia.Size Legal { get; set; }

Letter Property​

US Letter: 8.5 × 11 inches.

public Avalonia.Size Letter { get; set; }

Tabloid Property​

US Tabloid (Ledger upright): 11 × 17 inches.

public Avalonia.Size Tabloid { get; set; }