~sbinet/uca-print

Print documents via PaperCut
05c3b39a — Sebastien Binet 3 days ago
ci: bump Go-1.23
28d7a735 — Sebastien Binet 3 days ago
all: migrate to codeberg.org/emersion/go-scfg
bfff0729 — Sebastien Binet 6 months ago
cmd/uca-print-cfg: first import

clone

read-only
https://git.sr.ht/~sbinet/uca-print
read/write
git@git.sr.ht:~sbinet/uca-print

You can also use your local clone with git send-email.

#uca-print

Build status GoDoc godocs.io

uca-print is a set of tools to print documents from the command-line.

#Installation

$> go install git.sr.ht/~sbinet/uca-print/cmd/uca-print

#Examples

$> uca-print -h
Usage: uca-print [options] file1.pdf [file2.odt [...]]

ex:
 $> uca-print ./file1.pdf
 $> uca-print -u username ./file1.pdf ./file2.pdf
 $> uca-print -u username -p s3cr3t ./file1.pdf ./file2.pdf

options:
  -p string
    	password for papercut
  -t duration
    	timeout for sending files to print (default 20s)
  -u string
    	username for papercut

$> uca-print ./f1.pdf ./f2.pdf
uca-print: file: [ERR] "f1.pdf": Disallowed paper size: submission error
uca-print: file: [ OK] "f2.pdf"

$> echo $?
1

Credentials for uca-print can also be stored in $HOME/.config/uca-print/auth.cfg:

$> cat ~/.config/uca-print/auth.cfg
user     my-username
cred-cmd some authentication command # optional.

cred-cmd would typically point at, e.g.:

cred-cmd pass uca.fr/me

#uca-print-srv

uca-print also provides a REST-like server that can forward printing requests:

$> go install git.sr.ht/~sbinet/uca-print/cmd/uca-print-srv
$> uca-print-srv -addr :8080 -cert ./cert/server.crt -priv ./cert/server.key

and, in another terminal:

$> curl -X POST \
    -k ## to allow self-signed certificates \
    -u username:s3cr3t \
    --form file='@path-to-file1.pdf' \
    --form file='@path-to-file2.pdf' \
    --form file='@path-to-file3.pdf' \
    https://localhost:8080