iOS Guides | Samples

MonoTouch.UIKit.UIPrintInteractionController Class

Main driver for the printing process on iOS.

See Also: UIPrintInteractionController

Syntax

[MonoTouch.Foundation.Register("UIPrintInteractionController", true)]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 4, 2, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.TvOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public class UIPrintInteractionController : NSObject

Remarks

The UIPrintInteractionController provides access to the printing framework on iOS. To print on iOS, you configure the UIPrintInteractionController.SharedPrintController singleton by specifying your print task, optionally hook up to events and then you invoke the UIPrintInteractionController.Present(bool,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

C# Example

	//
	// 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) => {
            if (!completed & err != null){
                Console.WriteLine ("error");
            }
        });

Related content

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.UIKit.UIPrintInteractionController are listed below.

See Also: NSObject

Public Constructors

A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

ChooseCutterBehaviorUIPrintInteractionCutterBehavior. Delegate invoked by the object to get a value.
ChoosePaperUIPrintInteractionPaperList. Delegate invoked by the object to get a value.
[read-only]
override
ClassHandleIntPtr. The handle for this class.
CutLengthForPaperFunc<UIPrintInteractionController, UIPrintPaper, float>. Delegate invoked by the object to get a value.
DelegateUIPrintInteractionControllerDelegate. An instance of the MonoTouch.UIKit.UIPrintInteractionControllerDelegate model class which acts as the class delegate.
GetViewControllerUIPrintInteraction. Delegate invoked by the object to get a value.
[read-only]
static
PrintableUTIsNSSet. Uniform Type Identifiers for the types of data that UIKit can print.
PrintFormatterUIPrintFormatter. The UIPrintFormatter that will lay out of the content of pages based on the kind of content.
PrintInfoUIPrintInfo. Information about the print job.
[read-only]
static
PrintingAvailableBoolean. Whether printing is available.
PrintingItemNSObject. A ready-to-print object.
PrintingItemsNSObject[]. An array of ready-to-print objects.
PrintPageRendererUIPrintPageRenderer. If set, use the specified instance of UIPrintPageRenderer for printing.
[read-only]
PrintPaperUIPrintPaper. Holds the paper size and printing area for the print job. Read-only.
[read-only]
static
SharedPrintControllerUIPrintInteractionController. The shared print-interaction controller object.
ShowsNumberOfCopiesBoolean. Whether the printing options includes the number of copies to be printed.
ShowsPageRangeBoolean. Whether the printing options includes a page-range control.
ShowsPaperSelectionForLoadedPapersBoolean. Boolean set for enabling the paper selection menu.
WeakDelegateNSObject. An object that can respond to the delegate protocol for this type

Public Methods

static
CanPrint(NSData) : Boolean
Determines if the data stored in the NSData can be printed.
static
CanPrint(NSUrl) : Boolean
Whether printing is available.
Dismiss(Boolean)
Dismisses the printing-options sheet or popover.
Present(Boolean, UIPrintInteractionCompletionHandler)
Presents the iPhone printing interface.
PresentAsync(Boolean) : System.Threading.Tasks.Task<UIPrintInteractionResult>
Presents an iPhone printing user interface.
PresentFromBarButtonItem(UIBarButtonItem, Boolean, UIPrintInteractionCompletionHandler)
Presents the iPad printing user interface in a popover view that can be animated from a bar-button item.
PresentFromBarButtonItemAsync(UIBarButtonItem, Boolean) : System.Threading.Tasks.Task<UIPrintInteractionResult>
Presents an iPad printing user interface in a popover view that can be animated from a soecified bar-button item.
PresentFromRectInView(RectangleF, UIView, Boolean, UIPrintInteractionCompletionHandler)
Presents the iPad printing user interface in a popover view that can be animated from any area in a view.
PresentFromRectInViewAsync(RectangleF, UIView, Boolean) : System.Threading.Tasks.Task<UIPrintInteractionResult>
Presents the iPad printing user interface in a popover view that can be animated from any area in a view.
PrintToPrinter(UIPrinter, UIPrintInteractionCompletionHandler) : Boolean
Prints directly to a specified printer.

Protected Methods

override
Dispose(Boolean)
Releases the resources used by the UIPrintInteractionController object.

Public Events

DidDismissPrinterOptionsEvent raised by the object.
DidFinishJobEvent raised by the object.
DidPresentPrinterOptionsEvent raised by the object.
WillDismissPrinterOptionsEvent raised by the object.
WillPresentPrinterOptionsEvent raised by the object.
WillStartJobEvent raised by the object.