[NTG-context] \setuparranging values for perfect bound A5 on A3?
Bruce Horrocks
ntg at scorecrow.com
Sun Oct 9 20:24:30 CEST 2022
> On 9 Oct 2022, at 02:58, Max Chernoff <mseven at telus.net> wrote:
>
>
> Hi Bruce,
>
>> I have a book to be perfect bound[1] and I'm trying to work out what
>> imposition to use.
>>
>> The printer would like 4 A5 pages laid out on A3 e.g.
>>
>> +---+---+
>> | | |
>> | a | b |
>> | | |
>> +---+---+
>> | | |
>> | c | d |
>> | | |
>> +---+---+
>>
>> so that he can cut the paper and simply stack a, b, c, & d on top of
>> each other and then put them in the binding machine[2].
>>
>> If the book is 40 pages long, say, then stack 'a' has page 1 on the
>> top, page 2 on the reverse, then the next sheet has page 3 and 4, and
>> so on down to the last sheet which has page 9 on the front and page 10
>> on the back. Stack 'b' would have page 11 on the front, 12 on the back
>> and so on, so that each stack has a quarter of the book.
>>
>> Is this something LMTX can do and if so what combination of
>> \setuplayout and \setuppaper do I need to use? If they can be printed
>> in reverse order then great but I assume the printer can do that
>> fairly easily.
>
> I don't think that there's any way to do this from within a document
> run, so I think that you'll need to use an external program.
>
>> If not, is there a recommended external program that can do it?
>
> But, you can use ConTeXt as the external program here.
>
> Save as "imposition.cld":
>
> local filename = document.getargument("filename")
> local pdf = lpdf.epdf.image.open(filename)
> local pages = pdf.nofpages
> local max = math.ceil(pages / 4)
>
> context.setuppapersize({ "A5" }, { "A3" })
> context.setuppaper { nx = 2, ny = 2 }
> context.setuparranging { "XY" }
>
> local function insert_page(n)
> context.startpagemakeup()
> context.filterpages({ filename }, { n })
> context.stoppagemakeup()
> end
>
> context.starttext()
> for i = 1, max do
> if i % 2 == 1 then
> insert_page(i + 0 * max)
> insert_page(i + 1 * max)
> insert_page(i + 2 * max)
> insert_page(i + 3 * max)
> else
> insert_page(i + 1 * max)
> insert_page(i + 0 * max)
> insert_page(i + 3 * max)
> insert_page(i + 2 * max)
> end
> end
> context.stoptext()
>
> Then run:
>
> context imposition.cld --filename=document.pdf
>
> where "document.pdf" is replaced by your document name.
>
> I'm not sure if I got your desired output quite right here, but
> hopefully you can easily modify the script if something isn't quite
> right.
Thank-you Max - that is exactly what I wanted and your code worked first time. :)
—
Bruce Horrocks
Hampshire, UK
More information about the ntg-context
mailing list