Share via


UIPrintInteractionController Class

Definition

Main driver for the printing process on iOS.

[Foundation.Register("UIPrintInteractionController", true)]
public class UIPrintInteractionController : Foundation.NSObject
[<Foundation.Register("UIPrintInteractionController", true)>]
type UIPrintInteractionController = class
    inherit NSObject
Inheritance
UIPrintInteractionController
Attributes

Remarks

The UIPrintInteractionController provides access to the printing framework on iOS. To print on iOS, you configure the SharedPrintController singleton by specifying your print task, optionally hook up to events and then you invoke the Present(Boolean, UIPrintInteractionCompletionHandler) method to allow the user to select a printer and to print.

This class offers a number of mechanisms for printing, you can print using one of these configuration, based on your needs

  • Ready to print PDF file. You can print it by assigning to the PrintingItem property the NSUrl pointing to the file or the NSData that contains the PDF in memory.

    :

  • Ready to print image. You can print it by assigning to the PrintingItem property the UIImage or a photo ALAsset (the ALAsset with an AssetType of ALAssetType.Photo).

    :

  • Ready to print collection of images and PDF files. You can print it by assigning the mix of elements to the PrintingItems property an array of objects containing NSUrl, UIImage, NSData or ALAsset values.

    :

  • To layout information using using one of the built-in print formatters you would assign your print formatter to the PrintFormatter property. The built-in print formatters include the UISimpleTextPrintFormatter which can be used for simple rending text across multiple pages and has control for font, color, alignment and line breaking modes; For more advanced text printing you can use the UIMarkupTextPrintFormatter; For printing UIViews, you use the UIViewPrintFormatter which has a bulit-in ability to print the contents of a UIWebView, UITextView and MKMapView objects.

    :

  • For more advanced uses, where you might want to control the actual rendering of the page, you must implement a subclass of UIPrintPageRenderer and assign the instance of your renderer to the PrintPageRenderer property.

    :

	//
	// Print a PDF file, simple API
	//
NSUrl url = NSUrl.FromFilename ("SomeFile.pdf");           
	var printInfo = UIPrintInfo.PrintInfo;

printInfo.OutputType = UIPrintInfoOutputType.General;
printInfo.JobName = "Test: PDF Print";

var printer = UIPrintInteractionController.SharedPrintController;

printer.PrintInfo = printInfo;
printer.PrintingItem = url;
printer.ShowsPageRange = true;

printer.Present (true, (handler, completed, err) =&gt; {
if (!completed &amp; err != null){
Console.WriteLine ("error");
}
});

Constructors

Name Description
UIPrintInteractionController(NativeHandle)

A constructor used when creating managed representations of unmanaged objects. Called by the runtime.

UIPrintInteractionController(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

Name Description
AccessibilityAttributedUserInputLabels (Inherited from NSObject)
AccessibilityRespondsToUserInteraction (Inherited from NSObject)
AccessibilityTextualContext (Inherited from NSObject)
AccessibilityUserInputLabels (Inherited from NSObject)
ChooseCutterBehavior

Delegate invoked by the object to get a value.

ChoosePaper

Delegate invoked by the object to get a value.

Class (Inherited from NSObject)
ClassHandle

The Objective-C class handle for this class.

CutLengthForPaper

Delegate invoked by the object to get a value.

DebugDescription (Inherited from NSObject)
Delegate

An instance of the UIKit.IUIPrintInteractionControllerDelegate model class which acts as the class delegate.

Description (Inherited from NSObject)
GetViewController

Delegate invoked by the object to get a value.

Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
PrintableUTIs
PrintFormatter
PrintInfo
PrintingAvailable

Whether printing is available.

PrintingItem
PrintingItems
PrintPageRenderer
PrintPaper
RetainCount (Inherited from NSObject)
Self (Inherited from NSObject)
SharedPrintController
ShowsNumberOfCopies
ShowsPageRange
ShowsPaperOrientation
ShowsPaperSelectionForLoadedPapers
Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
WeakDelegate
Zone (Inherited from NSObject)

Methods

Name Description
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AwakeFromNib() (Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
CanPrint(NSData)
CanPrint(NSUrl)
ConformsToProtocol(NativeHandle) (Inherited from NSObject)
Copy() (Inherited from NSObject)
DangerousAutorelease()

Calls the 'autorelease' selector on this object.

(Inherited from NSObject)
DangerousRelease()

Calls the 'release' selector on this object.

(Inherited from NSObject)
DangerousRetain()

Calls the 'retain' selector on this object.

(Inherited from NSObject)
DidChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String) (Inherited from NSObject)
Dismiss(Boolean)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)
DoesNotRecognizeSelector(Selector) (Inherited from NSObject)
Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
GetDictionaryOfValuesFromKeys(NSString[]) (Inherited from NSObject)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
Init() (Inherited from NSObject)
InitializeHandle(NativeHandle, String) (Inherited from NSObject)
InitializeHandle(NativeHandle) (Inherited from NSObject)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MutableCopy() (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
Present(Boolean, UIPrintInteractionCompletionHandler)
PresentAsync(Boolean, Boolean)

Presents an iPhone printing user interface asynchronously.

PresentAsync(Boolean)

Presents an iPhone printing user interface.

PresentFromBarButtonItem(UIBarButtonItem, Boolean, UIPrintInteractionCompletionHandler)
PresentFromBarButtonItemAsync(UIBarButtonItem, Boolean, Boolean)

Asynchronously presents the iPad printing user interface in a popover view that can be animated from a bar-button item.

PresentFromBarButtonItemAsync(UIBarButtonItem, Boolean)

Presents an iPad printing user interface in a popover view that can be animated from a soecified bar-button item.

PresentFromRectInView(CGRect, UIView, Boolean, UIPrintInteractionCompletionHandler)
PresentFromRectInViewAsync(CGRect, UIView, Boolean, Boolean)

Asynchronously presents the iPad printing user interface in a popover view that can be animated from any area in a view.

PresentFromRectInViewAsync(CGRect, UIView, Boolean)

Presents an iPad printing user interface in a particular popover view that can be animated from any specified area in a view.

PrintToPrinter(UIPrinter, UIPrintInteractionCompletionHandler)
PrintToPrinterAsync(UIPrinter, Boolean)

Asynchronously prints directly to a specified printer, returning a task that provides the result.

PrintToPrinterAsync(UIPrinter)

Prints directly to a specified printer.

RemoveObserver(NSObject, NSString, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, NSString) (Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, String) (Inherited from NSObject)
RespondsToSelector(Selector) (Inherited from NSObject)
SetNilValueForKey(NSString) (Inherited from NSObject)
SetValueForKey(NSObject, NSString) (Inherited from NSObject)
SetValueForKeyPath(NativeHandle, NSString) (Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString) (Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString) (Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary) (Inherited from NSObject)
ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
ValueForKey(NSString) (Inherited from NSObject)
ValueForKeyPath(NSString) (Inherited from NSObject)
ValueForUndefinedKey(NSString) (Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String) (Inherited from NSObject)

Events

Name Description
DidDismissPrinterOptions

Event raised by the object.

DidFinishJob

Event raised by the object.

DidPresentPrinterOptions

Event raised by the object.

WillDismissPrinterOptions

Event raised by the object.

WillPresentPrinterOptions

Event raised by the object.

WillStartJob

Event raised by the object.

Extension Methods

Name Description
BrowserAccessibilityDeleteTextAtCursor(NSObject, IntPtr)
BrowserAccessibilityInsertTextAtCursor(NSObject, String)
GetAccessibilityLineEndPositionFromCurrentSelection(NSObject)
GetAccessibilityLineRangeForPosition(NSObject, IntPtr)
GetAccessibilityLineStartPositionFromCurrentSelection(NSObject)
GetBrowserAccessibilityAttributedValue(NSObject, NSRange)
GetBrowserAccessibilityContainerType(NSObject)
GetBrowserAccessibilityCurrentStatus(NSObject)
GetBrowserAccessibilityHasDomFocus(NSObject)
GetBrowserAccessibilityIsRequired(NSObject)
GetBrowserAccessibilityPressedState(NSObject)
GetBrowserAccessibilityRoleDescription(NSObject)
GetBrowserAccessibilitySelectedTextRange(NSObject)
GetBrowserAccessibilitySortDirection(NSObject)
GetBrowserAccessibilityValue(NSObject, NSRange)
SetBrowserAccessibilityContainerType(NSObject, BEAccessibilityContainerType)
SetBrowserAccessibilityCurrentStatus(NSObject, String)
SetBrowserAccessibilityHasDomFocus(NSObject, Boolean)
SetBrowserAccessibilityIsRequired(NSObject, Boolean)
SetBrowserAccessibilityPressedState(NSObject, BEAccessibilityPressedState)
SetBrowserAccessibilityRoleDescription(NSObject, String)
SetBrowserAccessibilitySelectedTextRange(NSObject, NSRange)
SetBrowserAccessibilitySortDirection(NSObject, String)
ProvideImageData(NSObject, IntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
ProvideImageToMTLTexture(NSObject, IMTLTexture, IMTLCommandBuffer, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)
GetDebugDescription(INSObjectProtocol)
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

AccessibilityHitTest(NSObject, CGPoint, UIEvent)
GetAccessibilityNextTextNavigationElement(NSObject)
GetAccessibilityNextTextNavigationElementBlock(NSObject)
GetAccessibilityPreviousTextNavigationElement(NSObject)
GetAccessibilityPreviousTextNavigationElementBlock(NSObject)
SetAccessibilityNextTextNavigationElement(NSObject, NSObject)
SetAccessibilityNextTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
SetAccessibilityPreviousTextNavigationElement(NSObject, NSObject)
SetAccessibilityPreviousTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
GetAccessibilityTextInputResponder(NSObject)
GetAccessibilityTextInputResponderHandler(NSObject)
SetAccessibilityTextInputResponder(NSObject, IUITextInput)
SetAccessibilityTextInputResponderHandler(NSObject, UITextInputReturnHandler)

Applies to

See also