ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Max Chernoff via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Max Chernoff <mseven@telus.net>
Subject: Re: \setuparranging values for perfect bound A5 on A3?
Date: Sat, 08 Oct 2022 19:58:09 -0600	[thread overview]
Message-ID: <ca9a5bbc4795a45e9210ddf4c37a6303a9aec04b.camel@telus.net> (raw)
In-Reply-To: <273794F1-B9A6-47FF-8E63-42CD4F1388DC@scorecrow.com>


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.

Thanks,
-- Max
___________________________________________________________________________________
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  1:58 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 [this message]
2022-10-09 18:24   ` Bruce Horrocks via ntg-context
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=ca9a5bbc4795a45e9210ddf4c37a6303a9aec04b.camel@telus.net \
    --to=ntg-context@ntg.nl \
    --cc=mseven@telus.net \
    /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).