User:Ssstephen/imposing

From XPUB & Lens-Based wiki

Every time i try to do this I forget. It would be nice to make a bash script but I think there are a lot of variables to consider. It is a complex ritual that depends on sensitivity to many conditions. For now I'll just document how I'm doing it today.

First we need to find out the width of the pages. Its called PageMediaDimensions and is usually the last line of this:

pdftk input.pdf dump_data

Usually the aim is to crop to half the width from each side, so we will end up with two pdf documents called left.pdf and right.pdf. The dump_data above told me in this case the width is 777.24 (dunno what unit, probably points?) so my crops will be 388.62 wide. This document is very narrow so these sizes are probably non standard, measure first if thats important. In particular I will generate two pdfs with the following two commands:

pdfcrop --margins "0 0 -388.62 0" input.pdf left.pdf
pdfcrop --margins "-388.62 0 0 0" input.pdf right.pdf

If this were a bash script, so far it would have found the page dimensions itself and run those two commands. but what if the pages are different sizes? Anyway, perform the spell. Now I need to combine these into a single pdf, shuffling the pages into eachother. This technique can be used to randomise order but in this specific situation it is actually restoring order. pdftk is my friend:

pdftk A=left.pdf B=right.pdf shuffle A B output singlepages.pdf

Today I will actually stop here and finish in acrobat, so in a way this is the opposite of imposition? deposition? The next step would be to use pdfimpose to prepare sheets for the printer but adobe so bye.