PrintDialog.PrintableAreaWidth Property

Definition

Gets the width of the printable area of the page.

C#
public double PrintableAreaWidth { get; }

Property Value

A Double that represents the width of the printable page area.

Examples

The following example shows how to get the value of the PrintableAreaWidth property by using Extensible Application Markup Language (XAML) markup and code.

XAML
<Button Width="200" Click="GetWidth">Get the Printable Width</Button>

...

C#
private void GetWidth(object sender, RoutedEventArgs e)
{
    PrintDialog pDialog = new PrintDialog();
    PrintQueue pq = pDialog.PrintQueue;     //force initialization of the dialog's PrintTicket or PrintQueue
    txt2.Text = pDialog.PrintableAreaWidth.ToString() + " is the printable width";
}

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10