From 5cc722828d1314a5cb3aaf9c00f2f7cad1988c95 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 30 Apr 2010 18:17:54 +0000 Subject: pdfjam update git-svn-id: svn://tug.org/texlive/trunk@18056 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/pdfjam/pdf180 | 4 +- Master/texmf-dist/scripts/pdfjam/pdf270 | 4 +- Master/texmf-dist/scripts/pdfjam/pdf90 | 4 +- Master/texmf-dist/scripts/pdfjam/pdfbook | 54 ++++++-- Master/texmf-dist/scripts/pdfjam/pdfflip | 4 +- Master/texmf-dist/scripts/pdfjam/pdfjam | 156 +++++++++++++--------- Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod | 13 +- Master/texmf-dist/scripts/pdfjam/pdfjam-slides3up | 10 +- Master/texmf-dist/scripts/pdfjam/pdfjam-slides6up | 10 +- Master/texmf-dist/scripts/pdfjam/pdfjoin | 9 +- Master/texmf-dist/scripts/pdfjam/pdfnup | 9 +- Master/texmf-dist/scripts/pdfjam/pdfpun | 17 +-- 12 files changed, 181 insertions(+), 113 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/pdfjam/pdf180 b/Master/texmf-dist/scripts/pdfjam/pdf180 index a9f4b7a250d..860be220297 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdf180 +++ b/Master/texmf-dist/scripts/pdfjam/pdf180 @@ -4,8 +4,8 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## -pdfjam --suffix rotated180 --angle 180 --fitpaper true "$@" +exec pdfjam --suffix rotated180 --angle 180 --fitpaper true "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdf270 b/Master/texmf-dist/scripts/pdfjam/pdf270 index bca6c57b02b..07e211fbe66 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdf270 +++ b/Master/texmf-dist/scripts/pdfjam/pdf270 @@ -4,8 +4,8 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## -pdfjam --suffix rotated270 --angle 270 --fitpaper true --rotateoversize true "$@" +exec pdfjam --suffix rotated270 --angle 270 --fitpaper true --rotateoversize true "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdf90 b/Master/texmf-dist/scripts/pdfjam/pdf90 index ac38aa490f3..7158aa5c9bb 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdf90 +++ b/Master/texmf-dist/scripts/pdfjam/pdf90 @@ -4,8 +4,8 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## -pdfjam --suffix rotated90 --angle 90 --fitpaper true --rotateoversize true "$@" +exec pdfjam --suffix rotated90 --angle 90 --fitpaper true --rotateoversize true "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfbook b/Master/texmf-dist/scripts/pdfjam/pdfbook index 8d032d3a351..2bd3e0fecbf 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfbook +++ b/Master/texmf-dist/scripts/pdfjam/pdfbook @@ -1,19 +1,55 @@ -#!/bin/sh +#!/bin/sh ## ## pdfbook: Rearrange pages of one or more PDF files into 2-up signatures ## -## Author David Firth (http://go.warwick.ac.uk/dfirth) +## Author David Firth (http://go.warwick.ac.uk/dfirth), with help +## from Marco Pessotto ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## -case "${1}" in - --right-edge-binding) +case $1 in + --short-edge) + shortedge=true ; shift ; - pdfjam --suffix book --signature* 4 --landscape "$@" ;; - *) - pdfjam --suffix book --signature 4 --landscape "$@" ;; + ;; + *) + ;; 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 diff --git a/Master/texmf-dist/scripts/pdfjam/pdfflip b/Master/texmf-dist/scripts/pdfjam/pdfflip index 125c4adea9c..8643abcd07e 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfflip +++ b/Master/texmf-dist/scripts/pdfjam/pdfflip @@ -4,6 +4,6 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## -pdfjam --suffix flipped --reflect true --fitpaper true "$@" +exec pdfjam --suffix flipped --reflect true --fitpaper true "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjam b/Master/texmf-dist/scripts/pdfjam/pdfjam index 52641909681..439040d6bc8 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfjam +++ b/Master/texmf-dist/scripts/pdfjam/pdfjam @@ -1,5 +1,5 @@ -#! /bin/sh -version=2.01 +#!/bin/sh +version=2.05 ######################################################################### ## ## ## pdfjam: A shell-script interface to the "pdfpages" LaTeX package ## @@ -18,10 +18,11 @@ version=2.01 ## do not accept that, then you must not use it. ## ## ## ## The path searched for site-wide configuration files can be set ## -## through the following variable: ## +## by editing the following variable: ## ## ## configpath='/etc:/usr/share/etc:/usr/local/share:/usr/local/etc' ## ## ## +## Nothing else in this file should need to be changed. ## ## ## ######################################################################### ## @@ -35,11 +36,16 @@ version=2.01 ## --- or whether all configuration files should be ignored. ## verbose=true -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --quiet | -q | --configpath) verbose=false ; ;; + --version | -V) + echo "$version" + exit 0 ; + ;; --batch) batch=true ; ;; @@ -56,7 +62,7 @@ done ## ## Check to see whether this is a "secondary" call to pdfjam: ## -if test "$PDFJAM_CALL_NUMBER" = "" ## not a secondary call +if test -z "$PDFJAM_CALL_NUMBER" ## not a secondary call then PDFJAM_CALL_NUMBER=0 fi @@ -81,8 +87,6 @@ newline=' ## Define a function to escape tricky characters in file names etc: ## escape_chars () { - ## use 'printf "%q" if available -# (printf "%q" "${1}") || (printf "%s" "${1}" | sed 's/[^a-zA-Z0-9._/\-]/\\&/g') } ## @@ -105,15 +109,15 @@ prattle () { ## second argument here is non-null for continuation lines lineCounter=`expr $lineCounter + 1` ; if test $lineCounter -eq 1 && test ! -n "${2}" ; then - if test -e "$PDFJAM_MESSAGES_FILE" - then printf "$prefix1$indent %b\n" "$line" 1>/dev/null >> \ + if test -w "$PDFJAM_MESSAGES_FILE" + then printf "$prefix1$indent %s\n" "$line" 1>/dev/null >> \ "$PDFJAM_MESSAGES_FILE" else messages="$messages$prefix1$indent $line$newline" ## msg file not made yet fi else - if test -e "$PDFJAM_MESSAGES_FILE" - then printf "$prefix2$indent %b\n" "$line" 1>/dev/null >> \ + if test -w "$PDFJAM_MESSAGES_FILE" + then printf "$prefix2$indent %s\n" "$line" 1>/dev/null >> \ "$PDFJAM_MESSAGES_FILE" else messages="$messages$prefix2$indent $line$newline" ## msg file not made yet @@ -183,10 +187,12 @@ checkfiles='false' ## Don't use the Unix 'file -Lb' utility to ## identify PDF files from their contents; ## rely on the .pdf or .PDF extension instead. ## -suffix='pdfjam' ## Default filename suffix to be used when +suffix='pdfjam' ## Default filename suffix to be used when ## --outfile is either (a) a directory, or (b) ## not specified in a --batch call. ## +preamble='' ## Default LaTeX preamble string. +## paper='a4paper' ## Default paper size is ISO A4. ## ## END OF SETTINGS MADE DIRECTLY WITHIN THE SCRIPT @@ -215,7 +221,7 @@ then IFS="$OIFS" PDFJAM_CONFIG=`printf "%s" "$PDFJAM_CONFIG" | sed 's/^/ /'` if test "$batch" = true ; then export PDFJAM_CONFIG ; fi - if test "$PDFJAM_CONFIG" = "" + if test -z "$PDFJAM_CONFIG" then prattle "(none found)" 1 else @@ -273,6 +279,9 @@ where --configpath Output the 'configpath' variable and exit immediately; no processing of PDF files. + --version (or -V) + Output the version number of pdfjam and exit immediately; no + processing of PDF files. --quiet (or -q) Suppress verbose commentary on progress. --batch @@ -319,8 +328,10 @@ where line. An example: pdfjam --nup 2x2 myfile.pdf -o myfile-4up.pdf \\ --preamble '\usepackage{fancyhdr} \pagestyle{fancy}' - The --preamble option can be used, for example, to load LaTeX - packages and/or to set global options. + The '--preamble' option can be used, for example, to load + LaTeX packages and/or to set global options. If '--preamble' + is used more than once in the call, the supplied preamble + strings are simply concatenated. --keepinfo --no-keepinfo Preserve (or not) Title, Author, Subject and Keywords @@ -392,9 +403,10 @@ where * '--' can be used to signal that there are no more options to come. Defaults for the options '--suffix', '--keepinfo', '--paper', '--outfile', -'--landscape', '--twoside', '--tidy' and '--checkfiles' can be set in -site-wide or user-specific configuration files. The path that is searched -for site-wide configuration files (named pdfjam.conf) at this installation is +'--landscape', '--twoside', '--tidy', '--checkfiles' and '--preamble' can be +set in site-wide or user-specific configuration files. The path that is +searched for site-wide configuration files (named pdfjam.conf) at this +installation is $configpath This configuration path can be changed by editing the pdfjam script if necessary. Any user-specific configuration should be put in a file named @@ -422,7 +434,7 @@ E_CONFIG=78 # configuration error ## Define a function to print an error message and exit: ## error_exit () { - if (test -e "$PDFJAM_MESSAGES_FILE") + if (test -r "$PDFJAM_MESSAGES_FILE") then cat "$PDFJAM_MESSAGES_FILE" >&2 else printf "$messages" 1>&2 fi @@ -451,8 +463,9 @@ optionsFinished="" ## ## First note any '--checkfiles' or '--no-checkfiles' option ## -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --checkfiles) checkfiles=true ; callOptions="$callOptions --checkfiles" ; @@ -467,7 +480,7 @@ while test -n "${1}${2}"; do argUnmatched="" if test "$optionsFinished" != true then - case "${1}" in + case ${1} in --) ## signals end of command-line options optionsFinished=true ; shift ; @@ -485,7 +498,7 @@ while test -n "${1}${2}"; do fileSpec=`printf "%s" "$fileSpec" | sed 's/|awaited/|-/g'` pageSpecAwaited=false fi - case "${1}" in + case ${1} in --batch) batch=true ; ;; @@ -575,11 +588,11 @@ while test -n "${1}${2}"; do --paper) paper="${2}" callOptions="$callOptions ${1} ${2}" ; - shift;; + shift ;; --pagecolor) pagecolor="${2}" ; callOptions="$callOptions ${1} ${2}" ; - shift;; + shift ;; --a4paper | --a5paper | --b5paper | --letterpaper | \ --executivepaper | --legalpaper) ## standard LaTeX paper sizes @@ -589,7 +602,7 @@ while test -n "${1}${2}"; do --a0paper | --a1paper | --a2paper | --a3paper | \ --a6paper | --b0paper | --b1paper | --b2paper | \ --b3paper | --b4paper | --b6paper) - ## the 'geonetry' package is needed + ## the 'geometry' package is needed if test "$geometry" != false ; then paper=`printf "%s" "${1}" | sed 's/^--//'` ; @@ -598,7 +611,7 @@ while test -n "${1}${2}"; do fi ; ;; --papersize) - ## the 'geonetry' package is needed + ## the 'geometry' package is needed if test "$geometry" != false ; then papersize="papersize=${2}" ; @@ -623,8 +636,7 @@ while test -n "${1}${2}"; do callOptions="$callOptions --no-twoside" ; ;; --preamble) - preamble="${2}" ; - callOptions="$callOptions ${1} '$preamble'" ; + preamble="$preamble${2}" ; shift ;; --*) ## options for \includepdfmerge @@ -642,9 +654,9 @@ while test -n "${1}${2}"; do ;; esac fi - if test "$optionsFinished" = true || test "$argUnmatched" = true + if test "$optionsFinished" = true || test "$argUnmatched" = true then - case "${1}" in + case ${1} in "" | /dev/stdin) fileSpec="${fileSpec}${newline}/dev/stdin|awaited" pageSpecAwaited=true @@ -663,13 +675,16 @@ while test -n "${1}${2}"; do if test "$checkfiles" = true ; ## not always available then case `file -Lb "${1}"` in - "PDF document"*) ## it's a PDF file as expected + "PDF document"*|"JPEG image data"*) + ## it's a PDF file as expected fileSpec="$fileSpec${newline}"${1}"|awaited" pageSpecAwaited=true ;; *) - case "${1}" in - *.[pP][dD][fF]) ## should be PDF file, but isn't + case ${1} in + *.[pP][dD][fF] | *.[jJ][pP][eE][gG] | \ + *.[jJ][pP][gG]) + ## should be PDF file, but isn't error_exit "no PDF file found at ${1}" \ $E_NOINPUT ;; @@ -688,8 +703,9 @@ while test -n "${1}${2}"; do ;; esac else ## no checking of file contents; rely on .pdf extension - case "${1}" in - *.[pP][dD][fF]) ## assume it's a PDF file + case ${1} in + *.[pP][dD][fF] | *.[jJ][pP][eE][gG] | *.[jJ][pP][gG]) + ## assume it's a PDF file test -f "${1}" || error_exit \ "${1} not found" $E_NOINPUT fileSpec="$fileSpec"$newline${1}"|"awaited @@ -722,7 +738,7 @@ fileSpec=`printf "%s" "$fileSpec" | sed '/^$/d; s/^ //; s/|awaited$/|-/'` if test $PDFJAM_CALL_NUMBER -eq 0 && test "$inputFromStdin" != true then ## the special argument '/dev/stdin' was not used - if test "$fileSpec" = "" ; then + if test -z "$fileSpec" ; then ## no argument specifying a PDF source was given inputFromStdin=true fileSpec="/dev/stdin|-" @@ -734,19 +750,22 @@ fi ## miscOptions=`printf "%s" "$miscOptions" | sed 's/^,//'` ## +if test -n "$preamble" +then callOptions="$callOptions --preamble '$preamble'" +fi ## Delete leading space from $callOptions: ## callOptions=`printf "%s" "$callOptions" | sed 's/^ //'` ## ## Set up a document options variable: ## -case "$landscape" in +case $landscape in true) orientation=landscape ;; *) orientation="" ;; esac -case "$twoside" in +case $twoside in true) twoside=twoside ;; *) @@ -755,11 +774,11 @@ esac if test "$geometry" != false then ## we haven't already found that geometry.sty is missing - case "$paper" in + case $paper in a0paper | a1paper | a2paper | a3paper | \ a6paper | b0paper | b1paper | b2paper | \ b3paper | b4paper | b6paper) - ## the 'geonetry' package is needed + ## the 'geometry' package is needed geometry=true ; ;; *) @@ -780,7 +799,7 @@ documentOptions=`printf "%s" "$documentOptions" | sed 's/^,//' | sed 's/,$//'` if test $PDFJAM_CALL_NUMBER -eq 0 ## not a secondary call then ## Check whether there's a pdflatex, if "$pdflatex" is still unset: - case "$pdflatex" in + case $pdflatex in "not found") error_exit "can't find pdflatex!" $E_UNAVAILABLE ;; @@ -853,7 +872,7 @@ then else if test "$keepinfo" = true then - case "$pdfinfo" in + case $pdfinfo in "not found") if test $PDFJAM_CALL_NUMBER -eq 0 then @@ -891,6 +910,7 @@ fi ## Use mktemp if possible; otherwise fall back on mkdir, ## with random name to make file collisions less likely. ## +original_umask=`umask` umask 177 if test $PDFJAM_CALL_NUMBER = 0 ## don't repeat this work for secondary calls then @@ -925,8 +945,9 @@ then messages="" ## we won't be using this variable again! else PDFJAM_TEMP_DIR="$PDFJAM_TEMP_DIR"/"file$PDFJAM_CALL_NUMBER" - umask 077 && mkdir "$PDFJAM_TEMP_DIR" + (umask 077 && mkdir "$PDFJAM_TEMP_DIR") fi +umask $original_umask ## ## TEMPORARY DIRECTORY ALL DONE ## @@ -1012,7 +1033,7 @@ counter=0 ## stdinUnread=true IFS="$newline" -for k in $fileSpec +for k in ${fileSpec} do counter=`expr $counter + 1` sourcePath=`printf "%s" "$k" | sed 's/|[^|]*$//'` @@ -1028,7 +1049,7 @@ do then error_exit "invalid page spec $pageSpec" $E_USAGE fi - case "$sourcePath" in + case $sourcePath in /dev/stdin) uniqueName="$PDFJAM_TEMP_DIR"/stdin.pdf if test "$stdinUnread" = true @@ -1044,7 +1065,7 @@ do ;; *) pdfName=`basename "$sourcePath"` - sourceDir=`dirname "$sourcePath"` + sourceDir=`dirname "$sourcePath"` ## zsh on Mac OS 10.5 chokes here cd "$sourceDir" || exit 1 ## just to get the full path sourceDir=`pwd` cd "$pwd" || exit 1 @@ -1069,13 +1090,17 @@ then prattle "Calling ${pdfinfo}..." ; PDFinfo=`pdfinfo "$uniqueName"`; pdftitl=`printf "%s" "$PDFinfo" | \ - grep -e '^Title:'| sed s/^Title:\\\s\*//`; + grep -e '^Title:'| sed s/^Title:\\\s\*// | \ + sed -e 's/[#$%^&_{}~]/\\\&/g'`; pdfauth=`printf "%s" "$PDFinfo" | \ - grep -e '^Author:'| sed s/^Author:\\\s\*//`; + grep -e '^Author:'| sed s/^Author:\\\s\*// | \ + sed -e 's/[#$%^&_{}~]/\\\&/g'`; pdfsubj=`printf "%s" "$PDFinfo" | \ - grep -e '^Subject:'| sed s/^Subject:\\\s\*//`; + grep -e '^Subject:'| sed s/^Subject:\\\s\*// | \ + sed -e 's/[#$%^&_{}~]/\\\&/g'`; pdfkeyw=`printf "%s" "$PDFinfo" | \ - grep -e '^Keywords:'| sed s/^Keywords:\\\s\*//`; + grep -e '^Keywords:'| sed s/^Keywords:\\\s\*// | \ + sed -e 's/[#$%^&_{}~]/\\\&/g'`; fi if test -n "$pdfTitle" ; then pdftitl="$pdfTitle" @@ -1102,11 +1127,12 @@ tempFile="$PDFJAM_TEMP_DIR"/temp.tex \documentclass[$documentOptions]{article} \usepackage{color} \definecolor{bgclr}{RGB}{$pagecolor} \pagecolor{bgclr} \usepackage[$papersize]{geometry} +\usepackage[utf8]{inputenc} \usepackage{hyperref} -\hypersetup{pdftitle=$pdftitl} -\hypersetup{pdfauthor=$pdfauth} -\hypersetup{pdfsubject=$pdfsubj} -\hypersetup{pdfkeywords=$pdfkeyw} +\hypersetup{pdftitle={$pdftitl}} +\hypersetup{pdfauthor={$pdfauth}} +\hypersetup{pdfsubject={$pdfsubj}} +\hypersetup{pdfkeywords={$pdfkeyw}} \usepackage{pdfpages} $preamble \begin{document} @@ -1120,13 +1146,13 @@ if test "$hyperref" = false; then ## we don't need hyperref sed '/\\\hypersetup.*/d' > "${texFile}" rm $tempFile fi -if test ! -n "$geometry" ; then geometry=false ; fi +if test -z "$geometry" ; then geometry=false ; fi if test "$geometry" = false; then ## geometry package is not to be used cp $texFile $tempFile cat $tempFile | sed '/\\\usepackage.*{geometry}/d' > $texFile rm $tempFile fi -if test "$pagecolor" = ""; then ## color package is not needed +if test -z "$pagecolor"; then ## color package is not needed cp $texFile $tempFile cat $tempFile | sed '/\\\usepackage.*{color}/d' > $texFile rm $tempFile @@ -1136,7 +1162,7 @@ fi ## ######################################################################### ## -## RUN PDFLATEX AND COPY THE RESULTING PDF FILE TO STDOUT +## RUN PDFLATEX AND COPY THE RESULTING PDF FILE ## prattle "Calling ${pdflatex}..." ; cd "$PDFJAM_TEMP_DIR" || exit 1 @@ -1147,11 +1173,10 @@ If '--no-tidy' was used, you can examine the log file at $fileName.log to try to diagnose the problem." -if ! ("$pdflatex" "$texFile" > "$msgFile") -then +$pdflatex $texFile > $msgFile || { prattle "$failureText" - error_exit "Output file not written" $E_SOFTWARE -fi + error_exit "Output file not written" $E_SOFTWARE +} cd "$pwd" || exit 1 if test -f "$fileName".pdf ## if LaTeX didn't choke then @@ -1172,7 +1197,7 @@ then separator="-" if test "$pageSpec" != "-" then - separator="-$pageSpec" + separator=-"$pageSpec"- fi outFile=`printf "%s" "$outFile" | sed 's/\/$//'` ## (delete any trailing slash) @@ -1188,8 +1213,9 @@ if test -f "$outFile" && test ! -w "$outFile" then error_exit "no write permission at ${outFile}" $E_CANTCREATE fi +#fileSize=`wc -c < "$fileName.pdf" | sed 's/^\ *//'` (cat "$fileName".pdf > "$outFile" 2>/dev/null) && - prattle "Finished. Output was to ${outFile}." || + prattle "Finished. Output was to '${outFile}'." || error_exit "cannot write output at ${outFile}" $E_CANTCREATE if (test "$PDFJAM_CALL_NUMBER" = "0") && ## not a secondary call (test $verbose = true) diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod b/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod index 0bebe86961c..864f4821140 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod +++ b/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod @@ -6,15 +6,16 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for (three runs of) pdfjam, version 2.01 +## This is a simple wrapper for (three runs of) pdfjam, version 2.05 ## ## ## It's hard (?) to set up this particular script to read from /dev/stdin, ## so we'll just insist that the first argument is a file: ## E_USAGE=64 ## for a command line usage error -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --batch) printf "pdfjam-pocketmod ERROR: the --batch option is not allowed\n" 1>&2 ; exit "$E_USAGE" ;; @@ -22,6 +23,8 @@ for arg in "$@"; do n='--no-tidy' ;; --quiet | -q) q='-q' ;; + --vanilla) + v='--vanilla' ;; --checkfiles) c='--checkfiles' ;; *) @@ -43,12 +46,12 @@ fi ## That's all the argument checking! ## pageSpec="1-8" ## the default page spec -case "${1}" in +case ${1} in --* | "") ## no page spec was given ;; *) ## a page spec was given, so use it pageSpec="$1" ; shift ;; esac -pdfjam $n $q $c -o /dev/stdout "$sourceFile" "$pageSpec" | pdfjam --angle 180 $n $q -o /dev/stdout /dev/stdin '1,8,7,6' | pdfjam --nup 4x2 --landscape --frame true "$sourceFile" '2-5' /dev/stdin "$@" +pdfjam $n $q $c $v -o /dev/stdout "$sourceFile" "$pageSpec" | pdfjam --angle 180 $n $q $v -o /dev/stdout /dev/stdin '1,8,7,6' | pdfjam --nup 4x2 --landscape --frame true "$sourceFile" '2-5' /dev/stdin "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjam-slides3up b/Master/texmf-dist/scripts/pdfjam/pdfjam-slides3up index 3bd461c8883..f6736bede44 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfjam-slides3up +++ b/Master/texmf-dist/scripts/pdfjam/pdfjam-slides3up @@ -5,13 +5,13 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## footskip=3.1cm ## default setting pagecommand='{\thispagestyle{empty}}' ## default setting -case "${1}" in +case ${1} in --pagenumbering) - case "${2}" in + case ${2} in false) continue ;; true) @@ -20,10 +20,10 @@ case "${1}" in pagecommand='{\thispagestyle{plain}}' ; footskip="$2" ;; esac ; - shift 2 ;; + shift; shift ;; *) continue ;; esac -pdfjam --suffix 3up --nup 1x3 --frame true --noautoscale false \ +exec pdfjam --suffix 3up --nup 1x3 --frame true --noautoscale false \ --delta "0cm 0.2cm" --scale 0.87 --offset "-3.8cm 0cm" \ --preamble "\footskip $footskip" --pagecommand "$pagecommand" "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjam-slides6up b/Master/texmf-dist/scripts/pdfjam/pdfjam-slides6up index 47fa2ea1ec8..3dd9136b81f 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfjam-slides6up +++ b/Master/texmf-dist/scripts/pdfjam/pdfjam-slides6up @@ -5,13 +5,13 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## footskip=2.7cm ## default setting pagecommand='{\thispagestyle{empty}}' ## default setting -case "${1}" in +case ${1} in --pagenumbering) - case "${2}" in + case ${2} in false) continue ;; true) @@ -20,11 +20,11 @@ case "${1}" in pagecommand='{\thispagestyle{plain}}' ; footskip="$2" ;; esac ; - shift 2 ;; + shift; shift ;; *) continue ;; esac -pdfjam --suffix 6up --nup 2x3 --frame true --noautoscale false \ +exec pdfjam --suffix 6up --nup 2x3 --frame true --noautoscale false \ --delta "0.2cm 0.3cm" --scale 0.95 --preamble "\footskip $footskip" \ --pagecommand "$pagecommand" "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjoin b/Master/texmf-dist/scripts/pdfjam/pdfjoin index 02c397fc31d..d475cd4e28a 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfjoin +++ b/Master/texmf-dist/scripts/pdfjam/pdfjoin @@ -4,11 +4,12 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## E_USAGE=64 ## for a command line usage error -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --batch) printf "pdfjoin ERROR: the --batch option is not allowed\n" 1>&2; exit "$E_USAGE" ;; @@ -20,6 +21,6 @@ for arg in "$@"; do *) continue ;; esac done -pdfjam --fitpaper true --rotateoversize true --suffix joined "$@" +exec pdfjam --fitpaper true --rotateoversize true --suffix joined "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfnup b/Master/texmf-dist/scripts/pdfjam/pdfnup index a4744a112fd..0b551d34fb5 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfnup +++ b/Master/texmf-dist/scripts/pdfjam/pdfnup @@ -4,11 +4,12 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for pdfjam, version 2.01 +## This is a simple wrapper for pdfjam, version 2.05 ## E_USAGE=64 ## for a command line usage error -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --orient) ## this was allowed in previous versions of pdfnup printf "pdfnup ERROR: the --orient option is not allowed,\n" 1>&2; printf " use --landscape or --no-landscape to specify\n" 1>&2; @@ -23,6 +24,6 @@ for arg in "$@"; do *) continue ;; esac done -pdfjam --suffix nup --nup 2x1 --landscape "$@" +exec pdfjam --suffix nup --nup 2x1 --landscape "$@" diff --git a/Master/texmf-dist/scripts/pdfjam/pdfpun b/Master/texmf-dist/scripts/pdfjam/pdfpun index eee08a05d33..aea8ff87eec 100755 --- a/Master/texmf-dist/scripts/pdfjam/pdfpun +++ b/Master/texmf-dist/scripts/pdfjam/pdfpun @@ -5,13 +5,14 @@ ## ## Author David Firth (http://go.warwick.ac.uk/dfirth) ## -## This is a simple wrapper for (three runs of) pdfjam, version 2.01 +## This is a simple wrapper for (three runs of) pdfjam, version 2.05 ## ## E_USAGE=64 ## for a command line usage error ## -for arg in "$@"; do - case "$arg" in +for arg +do + case $arg in --batch) printf "pdfpun ERROR: the --batch option is not allowed\n" 1>&2; exit "$E_USAGE" ;; @@ -29,7 +30,7 @@ shift ; ## ## Some (very) minimal checking of the first argument: ## -if test ! -e "$sourceFile" ; +if test ! -f "$sourceFile" ; then printf "pdfpun ERROR: first argument must be a PDF file\n" ; exit $E_USAGE ; @@ -45,21 +46,21 @@ fi ## That's all the argument checking! ## pageSpec="-" ## the default -case "${1}" in +case ${1} in --* | "") ;; *) ## a page spec was given pageSpec="$1" ; shift ;; esac -case "${1}" in +case ${1} in --outfile) outFile="$2" ; - shift 2 ;; + shift; shift ;; *) ;; esac -if test "$outFile" = "" ; +if test -z "$outFile" ; then printf "pdfpun ERROR: no output file specified\n" 1>&2 ; exit "$E_USAGE" ; -- cgit v1.2.3