lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically add empty pages at the end of a book


From: Knut Petersen
Subject: Re: Automatically add empty pages at the end of a book
Date: Wed, 10 Dec 2014 10:29:27 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 09.12.2014 22:45, Urs Liska wrote:

Am 09.12.2014 22:07, schrieb Knut Petersen:
On 09.12.2014 17:38, Urs Liska wrote:
Hi all,

if I produce scores that are to be printed on double-sided, folded sheets (i.e. 
four A4 pages on one A3 sheet) I need to find a way to add empty pages to the 
end of the score.


pdfjam is part of the pdfpages package. Try something like

pdfjam  --landscape  --keepinfo --paper a3paper --nup '2x1' --outfile out.pdf 
-- in.pdf



I have to repeat myself: My issue is not about the imposing from A4 to A3.
I want to produce a file in A4 that *can* be imposed on a folded A4 paper.
So it has to have a page count of a multiple of 4.

Well, then try something like this:

#!/bin/bash

if [ -z "$2" ]; then
   echo usage: $0 in.pdf out.pdf
   exit 1
fi

#
# we need pdfjam, so abort if it is not installed
#

PDFJAM=`which pdfjam`
if [ "$PDFJAM" = "" ]; then
   echo cannot find pdfjam!
   exit 2
fi

#
# we need pdfinfo, so abort if it is not installed
#

PDFINFO=`which pdfinfo`
if [ "$PDFINFO" = "" ]; then
   echo cannot find pdfinfo!
   exit 3
fi

#
# read the number of pages and calculate the remainder of
# (number of pages) / 4
#

INPAGES=`pdfinfo $1 | grep Pages | grep -o "[[:digit:]]*"`
let "MOD = INPAGES % 4"


#
# add 0 to 3 empty pages
#

if [ $MOD -eq "3" ]; then
        pdfjam --keepinfo --paper a4paper --outfile $2 -- $1 '1-,{}'
elif [ $MOD -eq "2" ]; then
        pdfjam --keepinfo --paper a4paper --outfile $2 -- $1 '1-,{},{}'
elif [ $MOD -eq "1" ]; then
        pdfjam --keepinfo --paper a4paper --outfile $2 -- $1 '1-,{},{},{}'
else
        cp $1 $2
fi

exit 0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]