Bug 3534 - QA Followup - use floating save
[koha.git] / misc / cronjobs / printoverdues.sh
blob6819e0cedef0ec0fbfb724a0144007cbd1a1f7b0
1 #!/bin/bash
3 print_usage(){
4 echo "$0 : generates PDF files from html files in directorys and prints them";
5 echo "usage :";
6 echo "$0 directory [css [printer_host [printername]]]"
7 echo " - directory directory to use to apply html2pdf transform";
8 echo " - css css file to apply to html ";
9 echo " - printer_host Network Name or IP of the printer (port possibly included) ";
10 echo " - printer_name printername ";
11 echo "Note that css printerhost and printername are optional parameters ";
12 echo "Note that this script uses xhtml2pdf command ";
13 echo " xhtml2pdf command comes with pisa (a python library)
14 To install you need setuptools library for python
15 then type easy_install pisa ";
17 exit 1;
19 if [ $# -lt 1 ]
20 then
21 print_usage
23 if [[ ! -d $1 ]]
24 then
25 echo "$1 : directory expected";
26 exit 1;
28 if [[ -n $2 && -f $2 ]]
29 then
30 optpisa="--css $2";
32 if [[ -n $3 ]]
33 then
34 optprinter="-h $3";
36 if [[ -n $4 ]]
37 then
38 optprinter="$optprinter -d $4";
40 for i in $1/*.html
42 xhtml2pdf $optpisa $i;
43 done
45 if [[ -n $optprinter ]]
46 then
47 lp $optprinter $1/*.pdf;
50 tar cvfzP $1`date "+%Y%m%d"`.tar.gz $1/*.pdf;