_XDocument2.PrintOut Method
Prints the form content as it is rendered in the window corresponding to the form's active view.
Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)
Syntax
'Declaration
Sub PrintOut
'Usage
Dim instance As _XDocument2
instance.PrintOut()
void PrintOut()
Implements
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 the OnLoador OnSwitchView events. 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 incorrectly.
A blank document may be printed.
The incorrect view may be printed.
The following exception may occur:
"Invalid context for the OM call."
Important
This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.
Examples
In the following example, the PrintOut method of the XDocument object is used to print the current view:
thisXDocument.PrintOut();