Android.Print.PrintManager.Print Method
Creates a print job for printing a Android.Print.PrintDocumentAdapter with default print attributes.

Syntax

[Android.Runtime.Register("print", "(Ljava/lang/String;Landroid/print/PrintDocumentAdapter;Landroid/print/PrintAttributes;)Landroid/print/PrintJob;", "")]
public PrintJob Print (string printJobName, PrintDocumentAdapter documentAdapter, PrintAttributes attributes)

See Also

PrintJob

Parameters

printJobName
A name for the new print job which is shown to the user.
documentAdapter
An adapter that emits the document to print.
attributes
The default print job attributes or null.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalStateExceptionIf not called from an Android.App.Activity.
Java.Lang.IllegalArgumentExceptionIf the print job name is empty or the document adapter is null.

Remarks

Creates a print job for printing a Android.Print.PrintDocumentAdapter with default print attributes.

Calling this method brings the print UI allowing the user to customize the print job and returns a Android.Print.PrintJob object without waiting for the user to customize or confirm the print job. The returned print job instance is in a PrintJobInfo.StateCreated state.

This method can be called only from an Android.App.Activity. The rationale is that printing from a service will create an inconsistent user experience as the print UI would appear without any context.

Also the passed in Android.Print.PrintDocumentAdapter will be considered invalid if your activity is finished. The rationale is that once the activity that initiated printing is finished, the provided adapter may be in an inconsistent state as it may depend on the UI presented by the activity.

The default print attributes are a hint to the system how the data is to be printed. For example, a photo editor may look at the photo aspect ratio to determine the default orientation and provide a hint whether the printing should be in portrait or landscape. The system will do a best effort to selected the hinted options in the print dialog, given the current printer supports them.

Note: Calling this method will bring the print dialog and the system will connect to the provided Android.Print.PrintDocumentAdapter. If a configuration change occurs that you application does not handle, for example a rotation change, the system will drop the connection to the adapter as the activity has to be recreated and the old adapter may be invalid in this context, hence a new adapter instance is required. As a consequence, if your activity does not handle configuration changes (default behavior), you have to save the state that you were printing and call this method again when your activity is recreated.

[Android Documentation]

Requirements

Namespace: Android.Print
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0