User Tools

Site Tools


labelprinting:summary

Label Printing

Since version 0.12, the new LabelPrintingAPI is integrated in yourCMDB. With the LabelPrintingAPI it is possible to create labels for CMDB objects which can be exported as PDF file or directly sent to a label printer for printing.

Please see the following example for a label:

On each label, the following information is displayed:

  • QR code
  • title with asset ID and configurable prefix (e.g. 'yourCMDB')
  • content of some object fields (which are special configured label fields or object summary fields)

configuration

The configuration is done in the configuration file etc/labelprinter-configuration.xml. Please see the follwing example:

<labelprinter-configuration>
        <labelprinter name="PDF">
                <label class="PdfLabel">
                        <parameter key="PageHeight" value="17" />
                        <parameter key="PageWidth" value="54" />
                        <parameter key="PageRotation" value="90" />
                        <parameter key="BorderTop" value="2" />
                        <parameter key="BorderBottom" value="2" />
                        <parameter key="BorderLeft" value="2" />
                        <parameter key="TitlePrefix" value="yourCMDB" />
                </label>
        </labelprinter>
        <labelprinter name="Default">
                <label class="PdfLabel">
                        <parameter key="PageHeight" value="17" />
                        <parameter key="PageWidth" value="54" />
                        <parameter key="PageRotation" value="90" />
                        <parameter key="BorderTop" value="2" />
                        <parameter key="BorderBottom" value="2" />
                        <parameter key="BorderLeft" value="2" />
                        <parameter key="TitlePrefix" value="yourCMDB" />
                </label>
                <printer class="PrinterIpp">
                        <parameter key="url" value="http://localhost:631/printers/PDF" />
                </printer>
        </labelprinter>
</labelprinter-configuration>

Multiple 'labelprinters' can be configured and must have a unique name, which is shown in the WebUI on the 'ShowObject' page.

A labelprinter consists of the following parts:

  • label
  • printer (optional)

A label is a class, which defines the design (e.g. borders, page size,…) and creates the output in a specific format (e.g. PDF). The configuration of a label is done by using the <label> tags and defining a label class followed by parameters with key value pairs, which make the design of the label configurable. The following classes are available at the moment:

classdescription
PdfLabellabel output in PDF format

The definition of a printer is optional. It defines the way, how the label is printed (for example sending data using the InternetPrintingProtocol). If no printer definition for a labelprinter is given, the label will be shown directly in the web browser. A printer is configured by using the <printer> tags and defining a printer class followed by parameters with key value pairs. The following classes are available at the moment:

classdescription
PrinterIppSend the data to a printer using the Internet Printing Protocol

configuration of the label content

In addition to a QR code and a title with asset ID, the content of some important object fields are shown on the label. If there a special labelfields configured in the Configuration of object types, the content of these fields is displayed. If not, the content of the object's summary fields is displayed.

If there is not enough space on the label, only the first fields were shown.

tested scenarios for directly printing labels

To print a label directly on a printer, the printer (print server) must support the data format, which is generated by a label class. At the moment, only PDF format is implemented and can be sent to printer/print server. The following scenario was tested very carefully and worked:

  • print server: CUPS
  • label printer: Brother QL720-NW

CUPS was used as a print server and has a label printer (in our example case a Brother QL720-NW, but every printer with CUPS support should work) configured. The label was generated as PDF and sent to CUPS using the Internet Printing Protocol and the class PrinterIpp.

labelprinting/summary.txt · Last modified: 2017/07/24 11:43 (external edit)