Renduva

Renduva documentation

Labels and printing

Renduva can fill ZPL label templates for Zebra printers, show a preview of a label, and send documents straight to a printer instead of returning them: PDF to office printers and print servers, ZPL labels to Zebra printers. Both need the Professional tier or higher.

ZPL label templates

A ZPL template is the label as a text file, with the same tags as a Word template. Design the label in ZebraDesigner (free from Zebra) or by hand, export it as ZPL, and type tags where the data goes:

^XA
^CI28
^FO60,60^A0N,45,45^FD{{customer}}^FS
^FO60,120^A0N,35,35^FD{{street}}, {{city}}^FS
^FO60,180^A0N,30,30^FDWeight {{weight | number 1}} kg^FS
^FO100,240^BY3^BCN,160,Y,N,N^FD{{order}}^FS
{{#items}}
^FO400,{{y}}^A0N,26,26^FD{{qty}} x {{sku}}^FS
{{/items}}
^XZ

Fields, formats, totals, sections and loops work as described in Templates and tags. A section tag alone on its line takes the line with it, so a loop like the one above repeats whole ZPL lines. Pictures, codes, charts, colors and {{html}} are Word-only; for barcodes and QR codes use ZPL's own commands (^BC, ^BQ and the others) with a tag in their field data, as in ^FD{{order}}^FS.

Data values are made safe for the printer. ^ and ~ start ZPL commands, so inside field data (between ^FD and ^FS) they are written as hex escapes and the field gets ^FH: a customer named "A^B" prints as "A^B" and cannot end the field. Outside field data, for example a position in ^FO{{x}},{{y}}, a value with ^ or ~ is an error. Start the label with ^CI28 so the printer reads the text as UTF-8 (accents, €).

Store the template on the server as label.zpl (the admin UI's Templates page takes .zpl files) or send it inline with "type": "zpl". Ask for "output": {"type": "zpl"} to get the filled label. Several records give one file with one label per record, which the printer prints in order.

Previewing a label

"output": {"type": "png"} draws the filled labels as one PNG image, one under another:

"output": { "type": "png", "options": { "width_mm": 101.6, "height_mm": 152.4, "dpmm": 8 } }
Option Meaning
width_mm, height_mm The label's size; default 101.6 x 152.4 mm (4 x 6 in)
dpmm The printer's dots per mm: 8 (203 dpi, default), 12 (300 dpi), 24 (600 dpi) or 6

The preview is drawn by Renduva itself, so label data never leaves your network. It is close to the printed label but not identical: the printer's own fonts are replaced by free ones of about the same width. Use it to check layout and data, and print a test label before a run. A preview shows at most 50 labels.

Printers

The server's admin names the printers; callers use only those names, never an address, so an API key cannot make the server connect anywhere else. Add them on the admin UI's Printers page or from the command line:

renduva printer add warehouse zpl://10.0.0.6:9100
renduva printer add office ipp://10.0.0.5/ipp/print
renduva printer add -skip-verify finance ipps://printserver.example.local/printers/finance
renduva printer test warehouse        # asks the printer for its status
renduva printer list
renduva printer remove office
Address Printer Takes
zpl://host:9100 Zebra and ZPL label printers, on their raw port ZPL
ipp://host/ipp/print Office printers that speak IPP (most made in the last ten years), and print servers: CUPS (ipp://server:631/printers/<queue>) or Windows PDF
ipps://... The same over TLS PDF

No printer drivers are installed on the Renduva server. IPP printers take the PDF directly ("driverless" printing). For an older printer that does not take PDF, add it to a print server that has its driver (CUPS or Windows) and give Renduva the print server's queue.

-no-status is for printers that do not report their status (some printers that emulate ZPL on other brands); -skip-verify accepts an ipps printer's self-signed certificate. Printers are kept in renduva-printers.json (the -printers option of serve).

Printing

Add print to a request: the document goes to the printer and the answer is its status.

{
  "template": "label",
  "data": { "customer": "City of Example", "order": "SO-104233" },
  "print": { "printer": "warehouse", "copies": 1, "wait": false }
}
Field Meaning
print.printer A printer name set up on the server
print.copies 1 to 100; default 1
print.wait true waits (up to 30 seconds) until the printer reports the job done

output.type may be left out: the printer decides, PDF for IPP printers and ZPL for Zebra printers. A Word template printed on an office printer is filled, turned into PDF and printed.

The answer is JSON:

{ "status": "queued", "printer": "warehouse", "job": 0, "pages": 0, "request_id": "8f2c..." }
Status Meaning
printed The printer reports the job done (with wait)
queued The printer took the job and is ready; it prints shortly
sent A printer that reports no status took the data: check the printer

Before anything is sent the printer is asked for its status, so a job does not wait in a printer that cannot print it (it would come out later, when someone fixes the printer). A printer problem returns 409 with a reason, and nothing is printed:

Reason Meaning
printer_paper_out Out of paper or labels
printer_head_open, printer_cover_open The print head, a cover or a door is open
printer_ribbon_out, printer_toner_out Out of ribbon, toner or ink
printer_paper_jam A paper jam
printer_paused, printer_offline, printer_stopped The printer is paused, offline or stopped
printer_busy Its buffer is full or it does not accept jobs now; try again
printer_over_temperature The print head is too hot
printer_job_failed With wait: the printer canceled or aborted the job
printer_refused The printer or print server refused the job, e.g. it needs a password or does not take PDF

502 (printer_unreachable) means the printer could not be contacted at its address; 404 (printer_not_found) that no printer has that name. The reason is also in the server's log line, with the printer's name.

Zebra printers answer status on their raw port, but they never confirm that a label came out: with wait, printed means the printer's buffer is empty and it reports no fault. A Zebra printer may also stop answering while it has some faults; Renduva then still sends the label and answers sent.

From PL/SQL and APEX

l_status := renduva.print(p_template => 'label', p_data => l_json, p_printer => 'warehouse');

renduva.print returns printed, queued or sent, and raises ORA-20100 with the reason for a printer problem, e.g. HTTP 409: printer warehouse: the printer is out of labels. It takes p_copies, p_wait, p_filename (the job's name in the printer's queue) and p_locale; a second form takes the template as a BLOB with p_template_type (default zpl).

In the APEX plug-ins, set Output to Direct to Printer and Printer Name to a printer name (or a substitution such as &P10_PRINTER.): the process or dynamic action prints instead of downloading, and the page shows the result. To let users choose, give P10_PRINTER the List of Values select name d, name r from table(renduva_apex.printers) (add where takes = 'zpl' for label printers only). In SQL Workshop, select * from table(renduva_apex.printers(100)) lists the server's printers for application 100, and renduva_apex.templates(100) its templates. For ZPL label templates, Output also offers Label Image (PNG), to check the filled labels on screen, and ZPL File, to download the label code (e.g. for a Zebra on a user's PC printed through Zebra Browser Print). The plug-in tells a ZPL template from other text by its file name (.zpl), or, for a template from SQL, by its first character (^ or ~); see APEX plug-in.