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?

Answered by abhishek12 in 776846022

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.

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"

Accepted Answer

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.

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"

Using CUPS in iOS
 
 
Q