Share via


XDocument.PrintOut Method

InfoPath Developer Reference

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

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.PrintOut

expression   An expression that returns a XDocument object.

Return Value
Nothing

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:
    JScript
    
    

    Invalid context for the OM call.

    Security Level 3: Can be accessed only by fully trusted forms.

    Example

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

    JScript
      XDocument.PrintOut();
    

    See Also