# PrintOut Method

Prints the form content as it is rendered in the window corresponding to the form's active view.

expression.PrintOut()

expression Required. An expression that returns a reference to an XDocument object.

## Security Level

3: Can be accessed only by fully trusted forms.

## Remarks

The PrintOut method uses the current printer settings. Returns a permission denied error if called from a form that is not fully trusted.

It is recommended that you don't call the PrintOut method from an OnLoad or OnSwitchView event procedure. You may encounter one or more of the following behaviors when calling the PrintOut method from an OnLoad or OnSwitchView event procedure:

- The view may print correctly.
- A blank document may be printed.
- The incorrect view may be printed.
- The following exception may occur:

  `Invalid context for the OM call.`

## Example

In the following example, the PrintOut method of the XDocument object is used to print the current view:

    XDocument.PrintOut();

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp