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

  • 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

(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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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