lilypond-user
[Top][All Lists]
Advanced

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

Re: Suggestions for page layout


From: David Wright
Subject: Re: Suggestions for page layout
Date: Wed, 25 Oct 2017 19:08:32 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed 25 Oct 2017 at 13:34:04 (-0700), Flaming Hakama by Elaine wrote:
> > I'm not top posting
> 
> I'm looking into getting a large format printer so I can print parts on
> tabloid paper.  As such, I'm looking for a way to create the pdfs necessary
> for doing the booklet layout.
> 
> Currently, the only way I know to to prepare such layouts, with two pages
> per spread and in an order like 4 1 | 2 3, is to use another tool, like
> InDesign.
> 
> I was hoping for something more organic to lilypond, that is text- and
> command line-based.
> 
> Does anyone have any suggestions for a workflow to accomplish this, or what
> tools to look at?

I used to use psnup, psbook and suchlike, which looked after computing
the page ordering. But I don't work with .ps files any more, only
PDFs, so now I use pdfjam and pdftk; the former for tiling, scaling
and shifts, the latter for things that involve whole pages.

But pdfjam can do the page-shuffling if given the ordering, so for
what you're intending, I would just use that. I compute the ordering
in bash with my own functions as I need variants for handing A6
booklets that save paper by stacking two copies.

I've stripped out some housekeeping functions etc, hopefully without
introducing typos. There are dependencies like TeX, pdfinfo, awk,
and bash of course.

These two functions are for generating the page ordering which is for
double-sided printing.

function -sig {
    local NUMPAGES="$(pdfinfo "$1" | awk '{if ( /^Pages:/ ) printf ( "%s", $2 
)}')"
    [ -z $NUMPAGES ] && printf '%s\n' "$1 has no pages!" >&2 && return 1
    local ROUNDUP=$NUMPAGES
    local REMAINDER=$(( $NUMPAGES % 4 ))
    [ $REMAINDER != 0 ] && ROUNDUP=$(( $NUMPAGES + 4 - $REMAINDER ))
    local DOWNS=$(( $ROUNDUP / 2 ))
    local UPS=$(( $DOWNS + 1 ))
    echo -n $(-sigger $DOWNS $NUMPAGES),$(-sigger $UPS $NUMPAGES)
    while DOWNS=$(( $DOWNS - 1 )) ; UPS=$(( $UPS + 1 )) ; [ $DOWNS -gt 0 ] ; do
        if [ $(( $DOWNS % 2 )) = 0 ] ; then
            echo -n ,$(-sigger $DOWNS $NUMPAGES),$(-sigger $UPS $NUMPAGES)
        else
            echo -n ,$(-sigger $UPS $NUMPAGES),$(-sigger $DOWNS $NUMPAGES)
        fi
    done
}

function -sigger {
    local DIFF=$(( $1 - $2 ))
    if [ $DIFF -gt 0 -o $1 -lt 1 ] ; then
        echo -n {}
    else
        echo -n $1
    fi
}

# These do the work (A4→A3r and US Letter→Ledger):

function a4-a4booklet {
    pdfjam --nup '2x1' --landscape --noautoscale 'true' --scale 1 --paper 
'a3paper' --outfile "${1/%.pdf/-a4booklet-a3.pdf}" "$1" "$(-sig "$1")"
}

function letter-letterbooklet {
    pdfjam --nup '2x1' --landscape --noautoscale 'true' --scale 1 --papersize 
'{11in,17in}' --outfile "${1/%.pdf/-letterbooklet-ledger.pdf}" "$1" "$(-sig 
"$1")"
}

You might find these useful for proofreading the layout, ie putting
pagespreads onto the screen to look at page balance/visual effects.

function a4-a4spreads {
    pdfjam --nup '2x1' --landscape --noautoscale 'true' --scale 1 --paper 
'a3paper' --outfile "${1/%.pdf/-a4spreads-a3.pdf}" "$1" 2-last,1
}

function letter-letterspreads {
    pdfjam --nup '2x1' --landscape --noautoscale 'true' --scale 1 --papersize 
'{11in,17in}' --outfile "${1/%.pdf/-letterspreads-ledger.pdf}" "$1" 2-last,1
}

Cheers,
David.



reply via email to

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