Using CUPS in iOS

I want to use CUPS in iOS for printing and it is mentioned at many places that we can use cups for printing in ios .But when i import library cups/cups.h ,xcode is giving error "cups/cups.h not found".

code i am using in a objective c file :

import <cups/cups.h>

cups_dest_t *dest;
int num_options;
cups_option_t *options;
int job_id;

/* Print a single file */
job_id = cupsPrintFile(dest->name, "/usr/share/cups/data/testprint.ps",
                        "Test Print", num_options, options);

Do i need to intall some driver or any library to make it work ? or is it the case that CUPS is not available for iOS?

Accepted Reply

I want to discover printers on worker thread .

My end goal it to do print operation explicitly on worker thread.

In UIkit, UIPrintInteractionController can send the printing job to printer in two ways: ,

  1. Presenting the printing user interface(using present() func , which can work only with main thread)
  2. Printing directly to a printer(using print() func , in which we can pass UIPrinter() object containing information about the printer and it can work with worker thread).

Using UIPrinterPickerController , which works on main thread , i can get list of printer . And then do the printing to that printer using method to of UIPrintInteractionController's method 2 of printing from worker thread .

But i want whole printing to be done on worker thread.

By using cups i want to discover the printers using worker thread , so that whole print operation in my application can happen on worker thread.

  • @eskimo i accepted my reply by mistake. And there is no option to undo it now.

Add a Comment

Replies

it is mentioned at many places that we can use CUPS for printing in iOS.

CUPS is public API on macOS, but it’s an implementation detail on iOS. What’s your high-level goal here?

This matters because most printing on iOS is done through UIKit.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I want to discover printers on worker thread

Add a Comment

I want to discover printers on worker thread .

My end goal it to do print operation explicitly on worker thread.

In UIkit, UIPrintInteractionController can send the printing job to printer in two ways: ,

  1. Presenting the printing user interface(using present() func , which can work only with main thread)
  2. Printing directly to a printer(using print() func , in which we can pass UIPrinter() object containing information about the printer and it can work with worker thread).

Using UIPrinterPickerController , which works on main thread , i can get list of printer . And then do the printing to that printer using method to of UIPrintInteractionController's method 2 of printing from worker thread .

But i want whole printing to be done on worker thread.

By using cups i want to discover the printers using worker thread , so that whole print operation in my application can happen on worker thread.

  • @eskimo i accepted my reply by mistake. And there is no option to undo it now.

Add a Comment

By using cups i want to discover the printers using worker thread

Are you looking for some specific type of printer? Or do you need to work with any printer supported by iOS?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Hi @eskimo I am looking for all printers connected to ios device . i want to discover the printers using worker thread , so that whole print operation in my application can happen on worker thread using UIPrintInteractionController's Print method (in print method of UIPrintInteractionController , i need to pass UIPrinter instance ,which i want to discover on worker thread)

  • I have mentioned my end goal in reply above (which is to do whole print operation in worker thread) . If not using cups , is there any other way to discover all the printers connected to ios device. If there is any other method to do this , using Bonjour service or any other api , can you please guide me how to do that ?

Add a Comment