Wiki

Clone wiki

Pipsta / Printing Using CUPS

Overview

Printing using CUPS on such a small factor printer as the Pipsta can be frustrating. Fortunately the CUPS printer driver shipped with Pipsta now scales the document provided to fit the paper. The scaling is optimised for A4. For installation follow this link.

Background

The following is a small sample of commands that allow the printers output to be customised. CUPS is a very generic system and there is still more work to be done in controlling the options presented to users via the GUI. However these CLI based examples should help you understand how the printer can be controlled.

Examples

Setting the Default Printer

The printer used in the Pipsta product is a customised Ap1400. This printer has 2 different IDs; one is Ap1400 and a new Pipsta ID. The CUPS driver installs 2 different printer drivers and default to Pipsta. However many people will have printers that identify themselves as Ap1400 printers.

Identifying the Printer

After installing the CUPS printer driver you can see how the system identifies the printer by going.

lsusb -vd 0483: | grep iProduct

If you see Ap1400 mentioned then the printer will be called Ap1400, else it should be called Pipsta.

A simple test is to ask the printer to feed '5' lines. So try -

printf "\x1Bd\x05" | lpr -P Ap1400
or
printf "\x1Bd\x05" | lpr -P Pipsta
or
printf "\x1Bd\x05" | lp -d Ap1400 -
or
printf "\x1Bd\x05" | lp -d Pipsta -

NOTE The CUPS software may induce a short delay, the printer will not respond immediately.

Setting the Default Printer

There are 3 ways to do this from the command line. The 1st 2 involve setting an environment variable. This will only affect the current session. The 3rd changes the default printer for this user and if run as sudo this will change the default printer on the whole system.

Setting the default by export PRINTER=Pipsta means that Pipsta will be default printer. This can also be achieved by going export LPDEST=Pipsta. Note that LPDEST will override PRINTER if both are set.

Finally you can control the default printer for the user (not just the current session) using lpoptions -d Pipsta or lpoptions -d Ap1400 (whichever is correct for you).

NOTE If you run lpoptions using sudo then you will be changing the default printer for all users.

Printing

Printing is really easy lpr -P Pipsta [file]. If file is a text file then the printer will print straight text. Any other file type will be rendered by CUPS and then scaled to fit the defined paper size.

If Pipsta is the only printer on the system (or has been setup as default) there is no need to name the printer on the command line.

The 2 most popular front ends to CUPS are lp and lpr. The options differ greatly between the front ends. However these front ends simply submit print jobs to the CUPS system so, no matter which you use, the same software is executed.

For more information see :-

Other options

For interest. These options have all proved useful (particularly the border option).

lpr -P Pipsta -o fit-to-page [file]
lpr -P Pipsta -o PageSize=Custom.48x75mm [file]
lpr -P Pipsta -o page-ranges=22 [file]
lpr -P Pipsta -o page-left=0 -o page-right=0 [file]
lpr -P Pipsta -o page-border=single [file]

Reference

The ultimate reference to CUPS options is https://www.cups.org/doc/options.html

Updated