From 6fa4b3dce00bcf913e1cc391ee6982b9947b7d21 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 7 May 2021 13:26:19 +0200 Subject: [PATCH] a5ona4 added --- .local/bin/tools/a5ona4 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .local/bin/tools/a5ona4 diff --git a/.local/bin/tools/a5ona4 b/.local/bin/tools/a5ona4 new file mode 100755 index 0000000..cf860b8 --- /dev/null +++ b/.local/bin/tools/a5ona4 @@ -0,0 +1,24 @@ +#!/bin/sh +current="$(pwd)" +INPUTPDF="$1" +printf '\\documentclass[a4paper,final]{article} +\\usepackage{pdfpages} +\\usepackage{ifpdf,ifxetex,everyshi} +\\makeatletter +\\ifpdf +\\EveryShipout{\\ifodd\\c@page\\else\\pdfpageattr{/Rotate 180}\\fi}%% +\\fi +\\ifxetex +\\EveryShipout{\\ifodd\\c@page\\special{pdf: put @thispage << /Rotate 180 >>}%% +\\fi +} +\\fi +\\makeatother +\\begin{document} +\\includepdf[pages=-, nup=1x2, booklet=true, landscape]{%s} +\\end{document}' "$current/$INPUTPDF" > /tmp/tmp$$.tex +cd /tmp || exit +pdflatex /tmp/tmp$$.tex +mv /tmp/tmp$$.pdf "$current/a5ona4_$INPUTPDF" +cd "$current" +rm -f /tmp/tmp$$.log /tmp/tmp$$.log