How to Create a UIprintpaper to Test UIprintinteractioncontrollerdelegate

How to create a UIPrintPaper to test UIPrintInteractionControllerDelegate

Can't control UIPrintPaper, but subclassing it to override its readonly properties is straighforward:

class FakePrintPaper: UIPrintPaper {

private let size: CGSize
override var paperSize: CGSize { return size }
override var printableRect: CGRect { return CGRect(origin: CGPointZero, size: size) }

init(size: CGSize) {
self.size = size
}
}

UIPrinterCutterBehavior delegate method never called

I found an answer to my question.

It must be STAR that haven't configured their printer with AirPrint properly.

They have 2 iOS SDK's; Standard and Legacy.. the Legacy SDK has all the functions I need to cut the paper. If you come across something like this, see if the manufacturer has an SDK for AirPrint.

How many maximum printings can UIPrintInteractionController (Swift) execute?

From the documentation :

1- var printingItems: [Any]? { get set }
Takes an array of printing-ready objects ( NSURL, NSData, UIImage, or ALAsset). The documentation doesn't cite any limit so we assume the limit would be the value of unsigned int in your architecture.

2- There are 2 delegate methods for the beginning and end of printing :
Start and End of a Print Job

func printInteractionControllerWillStartJob(UIPrintInteractionController)
//Tells the delegate that the print job is about to start.
func printInteractionControllerDidFinishJob(UIPrintInteractionController)
//Tells the delegate that the print job has ended.

You can use those to get the IsPrinting status. (between first and second).

3- The documentation doesn't offer any delegate method to get the waiting in queue

4- You can customise the alert using :

printInfo UIPrintInfo: The aforementioned print job configuration.
printPaper UIPrintPaper: A simple type that describes the physical and printable size of a paper type; except for specialized applications, this will be handled for you by UIKit.
showsNumberOfCopies Bool: When true, lets the user choose the number of copies.
showsPageRange Bool: When true, lets the user choose a sub-range from the printed material. This only makes sense with multi-page content—it’s turned off by default for images.
showsPaperSelectionForLoadedPapers Bool: When this is true and the selected printer has multiple paper options, the UI will let the user choose which paper to print on.

For some detailed explanation about printing using Swift, please refer to the following link:
UIPrint​Interaction​Controller - Written by Nate Cook

If this response was helpful and has what you needed, please don't forget to validate it :).

Good luck with your app.



Related Topics



Leave a reply



Submit