UIPrintInteractionController Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- 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) => {
if (!completed & 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
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. |