[cups.general] CUPS API to add printer to mac
Michael Sweet
msweet at apple.com
Tue Aug 30 16:49:48 PDT 2011
Basic code:
const char *printer_name = something;
const char *device_uri = something;
const char *ppd_name = something;
http_t *http;
ipp_status_t status;
ipp_t *request = ippNewRequest(CUPS_ADD_MODIFY_PRINTER);
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "printer-name", NULL, printer_name);
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL, device_uri);
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "ppd-name", NULL, ppd_name);
ippAddBoolean(request, IPP_TAG_PRINTER, "printer-is-accepting-jobs", 1);
ippAddInteger(request, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", IPP_PRINTER_IDLE);
ippDelete(cupsDoRequest(http, request, "/admin"));
status = cupsLastError();
Look for status == IPP_OK on success.
On Aug 30, 2011, at 6:13 AM, Azuri wrote:
> I am writing a Cocoa App which shuold call cups API to allow the user to add printer to mac , but entering the IP address or Queue. I am not sure how to do that in code and which API's to use.
> _______________________________________________
> cups mailing list
> cups at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups
__________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair
More information about the cups
mailing list