Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can you transform a text file (plain text or HTML) or print-format file (PS or PDF) to bind it as a book using shell commands? That is, how do you create a print-format file which orders pages into signatures so that in the simple case where the number of pages is divisible by 4 per signature, pages 1, 2, N-1 and N are on the first sheet (1 and N on the same side of the sheet), 3, 4, N-3 and N-2 on the next, etc, and the next signature is equal size and starts at page N+1? It could be done by careful manipulation using pdftk or similar tools, but hopefully there are already shell tools which do this reliably and without having to for example know in advance the number of pages which will be produced or the optimum signature size.

There's already a guide using Scribus, but it involves a lot of manual steps.

parts of a typical case-bound book, from www.ferdinando.org.uk

share|improve this question
Well, you can always put the 16 steps into a shell script. (I think the first 8 do not apply anyway, provided you already start with a PDF. psbook will add empty pages for you, if needed. The signature only depends on source and target paper size, so it doesn't really change.) – Ulrich Schwarz Feb 2 '12 at 9:18
up vote 3 down vote accepted

(I don't quite penetrate the way these signatures work, so these are merely pointers...)

Given a PDF file, pdfbook from the pdfjam tool set could be a one-stop solution to this problem, from the manpage:

pdfbook makes 2-up versions of PDF files, with the pages ordered as signatures.

It depends on pdflatex and the pdfpages LaTeX package (which you could thus use directly, too).

By the way the Scribus howto ("19 easy steps") can be simplified a little using pdfjam as it provides PDF equivalents to the tools mentioned there, i.e. pdfnup instead of psnup.)

Another way is using ConTeXt, see this wiki page on "Imposition", which also includes scripts (Lua and a link to a Perl script) for "Imposition by signature". If your input is XHTML, ConTeXt could be a solution "from XHTML to book signature", see this PDF document on XHTML in ConTeXt.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.