0

How many maximum printings can UIPrintInteractionController (Swift) execute?

I'm currently doing AirPrint for a project. Wondering how to do stress tests of printing in bulk in use of Printer Simulator.

  • Is there a delegate of something like printInteractionControllerIsPrintingJob?

  • How to debug a number of printing waiting in queue?

  • Is there any way to customise the alert view of printing?

Cheers,

1 Answers1

0

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.

Houssem Sdiri
  • 315
  • 1
  • 8
  • thank you very much @houssem. those are nice tips for me. I have one more question,,,, Is it possible to remove the AlertView while printing? http://imgur.com/a/LRwQ0 – murraymurraymurray Oct 06 '16 at 15:40
  • Yes, Please refer to [this Stackoverflow question](http://stackoverflow.com/questions/29925387/skipping-the-printing-ui-in-ios-8) . The accepted answer has what you want to do :): – Houssem Sdiri Oct 06 '16 at 21:09
  • thanks H. The link as you gave is to talk about UIPrintInteractionController. What I meant was just an alertView while being printing, see the image below. http://imgur.com/a/LRwQ0 – murraymurraymurray Oct 07 '16 at 09:48
  • You are welcome. Did you try the solution? It will only present an interface to choose the printer, then it will print directly to that printer without using the controller. Please try that code :) – Houssem Sdiri Oct 07 '16 at 10:01
  • thanks H. I've solved an issue to make a print without `UIPrinterControllerView`. What I meant about the `AlertView` is this: http://imgur.com/a/LRwQ0 . I don't need the view while printing execution. Anyway many thanks for your hospitality. – murraymurraymurray Oct 07 '16 at 14:50