print_slides and a5ona4 updates
This commit is contained in:
parent
c9bf213963
commit
10fc3361fb
30
.local/bin/print_slides
Executable file
30
.local/bin/print_slides
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# install cups-pdf and install printer using the webinterface on http://localhost:631/admin
|
||||
# default virtual printer dir is below, adjust if changed
|
||||
VIRTUAL_PRINTER_DIR="/var/spool/cupsd-pdf/$USER"
|
||||
# Printer to print magazine layout on
|
||||
PRINTER="Canon-MF220"
|
||||
for file in $@; do
|
||||
lpr -P Virtual_PDF_Printer -o number-up=2 -o orientation-requested=4 -o fit-to-page -o media=a4 "$file"
|
||||
str="."
|
||||
until lpc status | grep -A 4 'Virtual_PDF_Printer:' | tail -n1 | grep 'no entries'; do
|
||||
printf "\033[s\033[uPrinting to file for two slides per a5 page"
|
||||
printf "%s" $str
|
||||
printf "\033[u"
|
||||
str=$str.
|
||||
sleep 1
|
||||
done
|
||||
echo "virtual printing done."
|
||||
last_job_id="$(ls "$VIRTUAL_PRINTER_DIR" | grep -o '[0-9]*\.pdf$' | grep '[0-9]' | cut -d'.' -f1 | sort -n | tail -n1)"
|
||||
#echo "last_job_id:$last_job_id"
|
||||
file_two_page="$(ls $VIRTUAL_PRINTER_DIR/*${last_job_id}.pdf)"
|
||||
#echo "file_two_page:$file_two_page"
|
||||
printf "Invoking a5ona4..."
|
||||
a5ona4 "$file_two_page" > /dev/null
|
||||
echo "Done."
|
||||
rm "$file_two_page"
|
||||
only_filename_two_page="$( echo "$file_two_page"| awk -F/ '{print $NS}' )"
|
||||
echo "Magazine layout of $file being sent to printer..."
|
||||
lpr -P $PRINTER -o media=A4 -o Duplex=DuplexTumble -o sides=two-sided-short-edge -o BindEdge=Bottom -o media=a4 -r a5ona4_$file*
|
||||
done
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
#!/bin/zsh
|
||||
current="$(pwd)"
|
||||
INPUTPDF="$1"
|
||||
for file in $@; do
|
||||
INPUTPDF=/tmp/file.pdf
|
||||
cp -f "$file" $INPUTPDF
|
||||
printf '\\documentclass[a4paper,final]{article}
|
||||
\\usepackage{pdfpages}
|
||||
\\usepackage{ifpdf,ifxetex,everyshi}
|
||||
@ -16,9 +18,11 @@ printf '\\documentclass[a4paper,final]{article}
|
||||
\\makeatother
|
||||
\\begin{document}
|
||||
\\includepdf[pages=-, nup=1x2, booklet=true, landscape]{%s}
|
||||
\\end{document}' "$current/$INPUTPDF" > /tmp/tmp$$.tex
|
||||
\\end{document}' "$INPUTPDF" > /tmp/tmp$$.tex
|
||||
cd /tmp || exit
|
||||
pdflatex /tmp/tmp$$.tex
|
||||
mv /tmp/tmp$$.pdf "$current/a5ona4_$INPUTPDF"
|
||||
only_filename="$(echo "$file" | awk -F/ '{print $NF}')"
|
||||
mv /tmp/tmp$$.pdf "$current/a5ona4_$only_filename"
|
||||
cd "$current"
|
||||
rm -f /tmp/tmp$$.log /tmp/tmp$$.log
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user