michaelrsweet / lprint

A Label Printer Application
https://www.msweet.org/lprint
Apache License 2.0
227 stars 31 forks source link

LPrint API? #28

Closed SonnyX closed 3 years ago

SonnyX commented 3 years ago

Is there any API through either lprint or through CUPS in order to add an label printer using the drivers from lprint application?

michaelrsweet commented 3 years ago

@SonnyX Yes, the CUPS API will let you send IPP Create-Printer (IPP_OP_CREATE_PRINTER) to the lprint server. You can use the "lprint-add.c" code as a template for your own implementation.

SonnyX commented 3 years ago

@michaelrsweet Thank you, I've implemented similar code to what's inside of lprint-add.c, is there also a way to get the available lprint drivers names and descriptions programmatically through cups? I've looked inside of lprint-drivers.c and driver-common.c, however did not see an immediate way to do so.

michaelrsweet commented 3 years ago

@SonnyX You can do a Get-System-Attributes (IPP_OP_GET_SYSTEM_ATTRIBUTES) request to get the smi4699-device-command-supported attribute which lists the supported drivers.