Affichage des articles dont le libellé est lpr. Afficher tous les articles
Affichage des articles dont le libellé est lpr. Afficher tous les articles

lundi 21 mai 2012

lpoptions, default printing options for *nix (with cups)

The default command to send printing jobs under linux is "lpr", and all the commands that comes with it. To configure some options by default, for example for my office computer, I have to set them in the file : ~/.cups/lpoptions. This is what I have :
Default The_Printer_Name Binding=LeftBinding KMDuplex=Double StapleOption=1StapleLeft StapleSet=True
This will hence configure those option by default.
  • Binding : by default, put the binding ("reliure" (fr) ) on the left
  • KMDuplex : by default, print in duplex mode ("recto-verso" (fr)).
  • StapleOption : by default, staple once, on the left corner
  • StapleSet : by default, staple all documents.
NB 1 : Of course, I can modify all those options before printing, for example in acrobat-reader (acroread), or okular, or evince, or whatever I'm using. NB 2 : Those options may (or should I say "will") vary from one brand to another... (This is for a "KONICA MINOLTA bizhub C360 - 0" printer)

jeudi 26 février 2009

Imprimer des transparents

Imprimer des transparents

Dont un script que j'avais écrit il y a (très) longtemps pour imprimer des transparents :




#!/bin/bash

# convert .pdf slides into ps files with 4 slides/page

# takes : PDF documents in landscape (-l) or portrait (-p) orientation
# returns : PS document with 4 slides per page [file names $PREFIX*.ps]
#
# pages to be read in rows: [1] [2]
# [3] [4]

PREFIX=p4-
FORMAT=a4
MODULO=2:1,0
#

while getopts "lpb:f:h" opt ; do
case $opt in
f)FORMAT=$OPTARG;;
p)echo "Potrait mode"; MODULO=4:0,2,1,3;;#MODULO=4:1,3,2,0 ;;
l)echo "Landscape mode"; MODULO=2:1,0 ;;
b)PREFIX=$OPTARG;;
h)
cat < < EOF
convert .pdf slides into ps files with 4 slides/page
usage : $0 [-f] [-l|-p] [-p]
options :
-l landscape document (default)
-p portrait document
-f=FORMAT paper format (default is a4)
-p=PREFIX prefix appened to filename (default is "p4-")
-h this help message

For a fast use, just use 'pdf4ps file1.pdf file2.pdf',
and it will produce 'p4-file1.ps' and 'p4-file2.ps'.
EOF
exit;;

?)echo "Error : bad option. Try $0 -h"
exit;;
esac
done

shift $(($OPTIND - 1))

for i in "$*" ; do
if [ ! -f "$i" ]; then
echo "No file $i"
else
OUTFILE=$PREFIX`basename "$i" .pdf`.ps
if [ ! -f "$OUTFILE" ]; then
pdftops "$i" - \
| pstops "$MODULO" \
| psnup -4 -d1 -m0.2 -s0.5 -c \
| psresize -P"$FORMAT" -p"$FORMAT">"$OUTFILE"
else
echo "$PREFIX version of \"$i\" already exist ($OUTFILE)"
fi
fi
done

# Corentin Mehat oct2005-oct2006
# please send all bugs & ameliorations

# pdftops $i - \ # softs are to use ps files, convert the file to ps
# | pstops 2:1,0 \ # reorder mod 2 : odd, even
# | psnup -4 -d1 -m0.2 -s0.5 -c \ # border=1 margin=0.2 scale=0.5
# | psresize -Pletter -pletter>$OUTFILE # recenter