From de5d774b4b88b4ce80269a6c611fececa8f63c94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Hu=C5=A1ek?= <husek@iuuk.mff.cuni.cz>
Date: Wed, 13 Oct 2021 21:46:07 +0200
Subject: [PATCH] add pdfbook

---
 pdfbook | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100755 pdfbook

diff --git a/pdfbook b/pdfbook
new file mode 100755
index 0000000..a87c0b4
--- /dev/null
+++ b/pdfbook
@@ -0,0 +1,55 @@
+#!/bin/sh 
+##
+##  pdfbook: Rearrange pages of one or more PDF files into 2-up signatures
+##
+##  Author David Firth (http://go.warwick.ac.uk/dfirth), with help
+##  from Marco Pessotto
+##
+##  This is a simple wrapper for pdfjam, version N.NN 
+##
+case $1 in
+    --short-edge)
+	shortedge=true ;
+	shift ;
+	;;
+    *) 
+	;;
+esac
+for arg
+do
+    case $arg in
+	--signature*)
+	    ## catches both --signature and --signature*
+	    signature=true ; break
+	    ;;
+	*) ;;
+    esac
+done
+## 
+## If $signature is empty, we need to use a default:
+## 
+if test -z "$signature" ; then
+    signature="--signature 4"
+else
+    signature=""
+fi
+##
+## Make the call to pdfjam:
+##
+if test -z "$shortedge"
+then 
+    exec pdfjam --landscape --suffix book $signature "$@"
+else
+    (kpsewhich everyshi.sty >/dev/null) || {
+	echo "the 'everyshi' package is not installed."; exit 1
+    }
+    exec pdfjam --landscape --suffix book $signature \
+	--preamble '\usepackage{everyshi}
+\makeatletter
+\EveryShipout{\ifodd\c@page\pdfpageattr{/Rotate 180}\fi}
+\makeatother
+' "$@"
+fi
+
+
+
-- 
GitLab