PageSizes Class
Definition
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
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
| Name | Description |
|---|---|
| FromInches | A page size given in inches, as device-independent pixels. |
| FromMillimeters | A page size given in millimeters, as device-independent pixels. |
| Inches | Converts a length in inches to device-independent pixels. |
| Landscape | The size in landscape orientation: the longer edge becomes the width. A size that is already landscape is returned unchanged. |
| Millimeters | Converts a length in millimeters to device-independent pixels. |
| Portrait | The 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
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
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
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
Properties
| Name | Description |
|---|---|
| A3 | ISO A3: 297 × 420 mm. |
| A4 | ISO A4: 210 × 297 mm. |
| A5 | ISO A5: 148 × 210 mm. |
| Legal | US Legal: 8.5 × 14 inches. |
| Letter | US Letter: 8.5 × 11 inches. |
| Tabloid | US 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; }
Legal Property
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; }