1

Short introduction into the current architecture of a POS program which I am currently developping:
+ Web based database server
+ locally installed Mac Mini (Yosemite, headless) with database mirror, web server, PDF generator, print server, browser based UI
+ clients like iPad or Android tablets with bar code scanner connected

The problem: Provide names of printer queues to the program, which are label printers, thermo receipt printers and regular office laser printers. Each of them are needed for different tasks during the work flow.

Current solution (which works): I have a php config file, where queue names are hardcoded like

$cfg['labelprinter'] = 'DYMO_LW_450_desk';
$cfg['labelprinter_fallback'] = 'DYMO_LW_450_store';
$cfg['bonprinter'] = 'TM-T88V_desk';
$cfg['bonprinter_fallback'] = 'TM-T88IV_store';

Wanted solution: I want to provide a config UI where the store manager (which is not the IT admin) may set the actual printers for the program to use, best would be a select box. The user selection will be stored in the db and used by the program.

The question: How can I get a list of currently installed printers to generate a selectbox like this ?

<select name="labelprinter">
(<option value="queuename">real printer name, location</option>)
<option value="DYMO_LW_450_desk">DYMO LabelWriter 450, desk</option>
<option value="DYMO_LW_450_store">DYMO LabelWriter 450, store</option>
<option value="TM-T88V_desk">Epson TM-T88V, desk</option>
<option value="TM-T88IV_store">Epson TM-T88IV, store</option>
(<option value="other queuenames">other printer, other location</option>)
</select>

How can I read the CUPS config and generate a text file automatically which contains a list of these printers and store this in the htdocs path ?

  • You can use lpstat to generate a printer list. Check the man page for options. – fd0 Sep 17 '15 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.