ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Bruce Horrocks via ntg-context <ntg-context@ntg.nl>
To: Max Chernoff <mseven@telus.net>
Cc: Bruce Horrocks <ntg@scorecrow.com>,
	ntg-context mailing list <ntg-context@ntg.nl>
Subject: Re: \setuparranging values for perfect bound A5 on A3?
Date: Sun, 9 Oct 2022 19:24:30 +0100	[thread overview]
Message-ID: <959F3E95-2FB3-4041-8FDB-63E1EC98C750@scorecrow.com> (raw)
In-Reply-To: <ca9a5bbc4795a45e9210ddf4c37a6303a9aec04b.camel@telus.net>



> On 9 Oct 2022, at 02:58, Max Chernoff <mseven@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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-10-09 18:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09  0:29 Bruce Horrocks via ntg-context
2022-10-09  1:58 ` Max Chernoff via ntg-context
2022-10-09 18:24   ` Bruce Horrocks via ntg-context [this message]
2022-10-09  8:35 ` Henning Hraban Ramm via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=959F3E95-2FB3-4041-8FDB-63E1EC98C750@scorecrow.com \
    --to=ntg-context@ntg.nl \
    --cc=mseven@telus.net \
    --cc=ntg@scorecrow.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).