[NTG-context] Imposition with signatures (pdfpages/psbook emulation -- kind of announce)

Marco Pessotto melmothx at gmail.com
Sun Jan 16 18:44:23 CET 2011

Hello there.

I deal very often with imposition, useful for zinesters and to create
home-made booklets. ConTeXt by itself seems not to manage signatures,
i.e., given a text long 200 pages, it should be imposed in smaller
booklets of 50 pages each. (Or at least I didn't find anything about it)

At the beginning I was using psbook. But this requires a slow
processing (pdf -> ps; psbook ; ps -> pdf). 

Then I found out that pdfpages does the same thing (and better), and
started using that. Now that I switched to ConTeXt, I found that I
cannot use pdfpages without a latex installation.

So I wrote a script and a module to do the same thing without having to
install texlive. It uses MkIV and lua.

The code is stored at 


A minimal example and (minimal) documentation is provided.

The code does basically 2 things:

1) the module, using the \alibraryflushpages commands, fills the output
pdf (not imposed) with white pages, until it reach a “good” number,
multiple of 4. The signature is calculated at runtime, so you can
specify a minimum or a maximum (depends on your staple, if you can trim
the paper, and so on).

E.g., if the original pages are 128, no problem, the signature is 64 (16
sheets) and you can impose it without problems.

But, if the original pages are 129, the optimal signature is 44, so the
module will add 3 pages during the PDF compiling.

2) the perl script (which uses only standard perl libraries) creates a
temporary context file, gets the number of signatures provided by the
module (or passed as option if only the imposition is required against a
pdf without tex sources), and does the actual imposing (the algorithm is
taken from the psbook sources (the same used by pdfpages), including the
pages in the right order.

I'm not a real programmer, so it's a piece of spaghetti code. But seems
to work.

I'm posting this here because it's aimed to people that use the Minimals
only, as TeXLive already ships pdfpages, psbook and pdfpages to do the
same thing. (Well, the signature is not calculated on the fly by these

*If* there are people interested, I'd like to clean it up, improve it,
document it a bit better and so on. If not, well, sorry for the noise.



More information about the ntg-context mailing list