ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Is it possible to define a custom imposition schema? (sure it is, but how?)
@ 2012-05-29 17:06 Marco Pessotto
  2012-05-29 17:13 ` Hans Hagen
  2012-05-29 18:04 ` Willi Egger
  0 siblings, 2 replies; 8+ messages in thread
From: Marco Pessotto @ 2012-05-29 17:06 UTC (permalink / raw)
  To: ntg-context


Hello there.

I'd need a custom imposition schema, just like the 2*4*2, but first the
sheets will be folded, then inserted in signatures of 16 pages, and then
finally bound. (They said the machine can fold only one sheet).

I came up with 3 "solutions" (or 3 hacks, as you wish):

1. psutils/pstops 

2. layers

3. hack page-imp.mkiv


1. The first solution would be the faster, but after spending a day on
it I gave up, because I have endless issue with cropped pages, paper
dimension not correctly set, and I only scratched the surface. I don't
know if exists some support for psutils (doesn't look so), but I have
the feeling that software is pretty dead.

2. Layers: I'm attaching the code below. Does it seem sensible, or is
there a better way to do it? (I'll create a template from that, and will
loop over every 16 pages with the usual perl hack). It seems to work,
even if visually it looks a bit shifted to right (I can adjust
it manually). [An alternate approach could be just various \hbox, but
maybe the layer solution is better for absolute positioning]

3. page-imp.mkiv would be the best solution (obviously). I've dug a bit
into the code, but I'm in deep waters. I can't understand where the
sequence of the pages is defined. the \pusharrangedpageSCHEMA seems just
to define the position inside the page, not the sequence of the shipped
out page. Also, what are \c_page_marks_nx and \c_page_marks_ny?  Any
hint about how this machinery works?


Thanks

Best wishes


% start draft

\definepapersize[carta][width=320mm,height=440mm]
\setuppapersize[carta][carta]
\setuplayout
   [topspace=0pt,
   backspace=0pt,
   header=0pt,
   footer=0pt,
   margin=0pt,
   marking=on,
   width=320mm,
   height=440mm,
   location=middle]

\setuppagenumbering[alternative=doublesided,location=]
\setuprotate[location=depth,rotation=180]

% \showframe

\starttext

% page one

\definelayer[PageLayer1][position=no]
\setuplayer
   [PageLayer]
   [preset=topleft,
    height=\paperheight,width=\paperwidth]

\setlayer[PageLayer1][x=0mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=13]
    }
}
\setlayer[PageLayer1][x=160mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=4]
    }
}
\setlayer[PageLayer1][x=0mm,y=220mm]{
  \externalfigure[libretto.pdf][page=16]
}
\setlayer[PageLayer1][x=160mm,y=220mm]{
  \externalfigure[libretto.pdf][page=1]
}
\placelayer[PageLayer1]

%%% page 2

\definelayer[PageLayer2][position=no]
\setuplayer
   [PageLayer]
   [preset=topleft,
    option=test,
    height=\paperheight,width=\paperwidth]

\setlayer[PageLayer2][x=0mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=3]
    }
}
\setlayer[PageLayer2][x=160mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=14]
    }
}
\setlayer[PageLayer2][x=0mm,y=220mm]{
  \externalfigure[libretto.pdf][page=2]
}
\setlayer[PageLayer2][x=160mm,y=220mm]{
  \externalfigure[libretto.pdf][page=15]
}
\placelayer[PageLayer2]

%page 3

\definelayer[PageLayer3][position=no]
\setuplayer
   [PageLayer]
   [preset=topleft,
    option=test,
    height=\paperheight,width=\paperwidth]

\setlayer[PageLayer3][x=0mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=9]
    }
}
\setlayer[PageLayer3][x=160mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=8]
    }
}
\setlayer[PageLayer3][x=0mm,y=220mm]{
  \externalfigure[libretto.pdf][page=12]
}
\setlayer[PageLayer3][x=160mm,y=220mm]{
  \externalfigure[libretto.pdf][page=5]
}
\placelayer[PageLayer3]

% page 4
\definelayer[PageLayer4][position=no]
\setuplayer
   [PageLayer]
   [preset=topleft,
    option=test,
    height=\paperheight,width=\paperwidth]

\setlayer[PageLayer4][x=0mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=7]
    }
}
\setlayer[PageLayer4][x=160mm,y=0mm]{
\rotate{
      \externalfigure[libretto.pdf][page=10]
    }
}
\setlayer[PageLayer4][x=0mm,y=220mm]{
  \externalfigure[libretto.pdf][page=6]
}
\setlayer[PageLayer4][x=160mm,y=220mm]{
  \externalfigure[libretto.pdf][page=11]
}
\placelayer[PageLayer4]

\stoptext




-- 
Marco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 17:06 Is it possible to define a custom imposition schema? (sure it is, but how?) Marco Pessotto
@ 2012-05-29 17:13 ` Hans Hagen
  2012-05-29 18:54   ` Marco Pessotto
  2012-05-29 18:04 ` Willi Egger
  1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2012-05-29 17:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco Pessotto

On 29-5-2012 19:06, Marco Pessotto wrote:

> 3. page-imp.mkiv would be the best solution (obviously). I've dug a bit
> into the code, but I'm in deep waters. I can't understand where the
> sequence of the pages is defined. the \pusharrangedpageSCHEMA seems just
> to define the position inside the page, not the sequence of the shipped
> out page. Also, what are \c_page_marks_nx and \c_page_marks_ny?  Any
> hint about how this machinery works?

You also need a popper as in:

\installpagearrangement 2*8
   {\dosetuparrangement{4}{2}{8}{5}{3}%
      \pusharrangedpageSIXTEEN\poparrangedpagesAB\relax}

how/what depends on the scheme

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 17:06 Is it possible to define a custom imposition schema? (sure it is, but how?) Marco Pessotto
  2012-05-29 17:13 ` Hans Hagen
@ 2012-05-29 18:04 ` Willi Egger
  2012-05-29 19:00   ` Marco Pessotto
  1 sibling, 1 reply; 8+ messages in thread
From: Willi Egger @ 2012-05-29 18:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Marco,

If I understand correctly what you need is a system which is basically based on booklet-printing but each booklet should be restricted to 16 pages.
In this case you might try 

\setuparranging[2*2*4]

This scheme put two pages on the front and two pages on the backside of a sheet of paper. Then it uses 4 sheets to complete the section.

Willi
On May 29, 2012, at 7:06 PM, Marco Pessotto wrote:

> 
> Hello there.
> 
> I'd need a custom imposition schema, just like the 2*4*2, but first the
> sheets will be folded, then inserted in signatures of 16 pages, and then
> finally bound. (They said the machine can fold only one sheet).
> 
> I came up with 3 "solutions" (or 3 hacks, as you wish):
> 
> 1. psutils/pstops 
> 
> 2. layers
> 
> 3. hack page-imp.mkiv
> 
> 
> 1. The first solution would be the faster, but after spending a day on
> it I gave up, because I have endless issue with cropped pages, paper
> dimension not correctly set, and I only scratched the surface. I don't
> know if exists some support for psutils (doesn't look so), but I have
> the feeling that software is pretty dead.
> 
> 2. Layers: I'm attaching the code below. Does it seem sensible, or is
> there a better way to do it? (I'll create a template from that, and will
> loop over every 16 pages with the usual perl hack). It seems to work,
> even if visually it looks a bit shifted to right (I can adjust
> it manually). [An alternate approach could be just various \hbox, but
> maybe the layer solution is better for absolute positioning]
> 
> 3. page-imp.mkiv would be the best solution (obviously). I've dug a bit
> into the code, but I'm in deep waters. I can't understand where the
> sequence of the pages is defined. the \pusharrangedpageSCHEMA seems just
> to define the position inside the page, not the sequence of the shipped
> out page. Also, what are \c_page_marks_nx and \c_page_marks_ny?  Any
> hint about how this machinery works?
> 
> 
> Thanks
> 
> Best wishes
> 
> 
> % start draft
> 
> \definepapersize[carta][width=320mm,height=440mm]
> \setuppapersize[carta][carta]
> \setuplayout
>   [topspace=0pt,
>   backspace=0pt,
>   header=0pt,
>   footer=0pt,
>   margin=0pt,
>   marking=on,
>   width=320mm,
>   height=440mm,
>   location=middle]
> 
> \setuppagenumbering[alternative=doublesided,location=]
> \setuprotate[location=depth,rotation=180]
> 
> % \showframe
> 
> \starttext
> 
> % page one
> 
> \definelayer[PageLayer1][position=no]
> \setuplayer
>   [PageLayer]
>   [preset=topleft,
>    height=\paperheight,width=\paperwidth]
> 
> \setlayer[PageLayer1][x=0mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=13]
>    }
> }
> \setlayer[PageLayer1][x=160mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=4]
>    }
> }
> \setlayer[PageLayer1][x=0mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=16]
> }
> \setlayer[PageLayer1][x=160mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=1]
> }
> \placelayer[PageLayer1]
> 
> %%% page 2
> 
> \definelayer[PageLayer2][position=no]
> \setuplayer
>   [PageLayer]
>   [preset=topleft,
>    option=test,
>    height=\paperheight,width=\paperwidth]
> 
> \setlayer[PageLayer2][x=0mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=3]
>    }
> }
> \setlayer[PageLayer2][x=160mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=14]
>    }
> }
> \setlayer[PageLayer2][x=0mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=2]
> }
> \setlayer[PageLayer2][x=160mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=15]
> }
> \placelayer[PageLayer2]
> 
> %page 3
> 
> \definelayer[PageLayer3][position=no]
> \setuplayer
>   [PageLayer]
>   [preset=topleft,
>    option=test,
>    height=\paperheight,width=\paperwidth]
> 
> \setlayer[PageLayer3][x=0mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=9]
>    }
> }
> \setlayer[PageLayer3][x=160mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=8]
>    }
> }
> \setlayer[PageLayer3][x=0mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=12]
> }
> \setlayer[PageLayer3][x=160mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=5]
> }
> \placelayer[PageLayer3]
> 
> % page 4
> \definelayer[PageLayer4][position=no]
> \setuplayer
>   [PageLayer]
>   [preset=topleft,
>    option=test,
>    height=\paperheight,width=\paperwidth]
> 
> \setlayer[PageLayer4][x=0mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=7]
>    }
> }
> \setlayer[PageLayer4][x=160mm,y=0mm]{
> \rotate{
>      \externalfigure[libretto.pdf][page=10]
>    }
> }
> \setlayer[PageLayer4][x=0mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=6]
> }
> \setlayer[PageLayer4][x=160mm,y=220mm]{
>  \externalfigure[libretto.pdf][page=11]
> }
> \placelayer[PageLayer4]
> 
> \stoptext
> 
> 
> 
> 
> -- 
> Marco
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 17:13 ` Hans Hagen
@ 2012-05-29 18:54   ` Marco Pessotto
  0 siblings, 0 replies; 8+ messages in thread
From: Marco Pessotto @ 2012-05-29 18:54 UTC (permalink / raw)
  To: ntg-context


Hans Hagen <pragma@wxs.nl> writes:

> On 29-5-2012 19:06, Marco Pessotto wrote:
>
>> 3. page-imp.mkiv would be the best solution (obviously). I've dug a bit
>> into the code, but I'm in deep waters. I can't understand where the
>> sequence of the pages is defined. the \pusharrangedpageSCHEMA seems just
>> to define the position inside the page, not the sequence of the shipped
>> out page. Also, what are \c_page_marks_nx and \c_page_marks_ny?  Any
>> hint about how this machinery works?
>
> You also need a popper as in:
>
> \installpagearrangement 2*8
>   {\dosetuparrangement{4}{2}{8}{5}{3}%
>      \pusharrangedpageSIXTEEN\poparrangedpagesAB\relax}
>
> how/what depends on the scheme

Hello Hans, thanks for the reply.

I looked at the poppers and I can't understand what they do. I think
I'll go with the layers solution :-) (I'm good at workarounds and
hacking there is an overkill for what I'm trying to do)

Best wishes

-- 
Marco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 18:04 ` Willi Egger
@ 2012-05-29 19:00   ` Marco Pessotto
  2012-05-29 20:21     ` Willi Egger
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Pessotto @ 2012-05-29 19:00 UTC (permalink / raw)
  To: ntg-context

Willi Egger <context@boede.nl> writes:

> Hi Marco,
>
> If I understand correctly what you need is a system which is basically
> based on booklet-printing but each booklet should be restricted to 16
> pages.  In this case you might try
>
> \setuparranging[2*2*4]
>
> This scheme put two pages on the front and two pages on the backside
> of a sheet of paper. Then it uses 4 sheets to complete the section.
>
> Willi

Hello Willi, thanks for your reply.

No, the scheme is quite complicated (from 1 to 16) because the pages are
first folded, then the two *folded* sheets are inserted one into the
other, and then signature is bound and trimmed.

So the scheme looks so (R means rotated 180°):

 
 13 R | 4 R
 -----------     
 16   |  1


 3 R  | 14 R
 -----------
 2    | 15


 9 R  | 8 R
 -----------
 12   |  5

 7R   | 10R
 ----------
 6    |  11


Yes, that's crazy (if you ask me). As I said, I'll go with the layers
and a perl helper, the outcome looks almost fine.

Best wishes

-- 
Marco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 19:00   ` Marco Pessotto
@ 2012-05-29 20:21     ` Willi Egger
  2012-05-29 22:16       ` Marco Pessotto
  0 siblings, 1 reply; 8+ messages in thread
From: Willi Egger @ 2012-05-29 20:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users


To my knowledge the printer will have more hand-work than accepting that e.g. the 2*4*2 or the 2*2*4 scheme is used. - Again, if I understand you correctly, then the folding machine can only do a single fold. So after assembling the section with two folded sheets still a manual fold must be made along the spine. I expect that the assembly is quite unstable if it has to be stitched/sewn.

 In the first case one can pick two sheets and fold them twice, resulting in a 16 pages section. Such folded sections are stable for stitching/sewing.  Even more easy  is the 2*2*4 approach, with a single folding over the spine you end up with a section of 16 pages. This kind of section is reasonably stable for stitching/sewing. 

Willi
On May 29, 2012, at 9:00 PM, Marco Pessotto wrote:

> Willi Egger <context@boede.nl> writes:
> 
>> Hi Marco,
>> 
>> If I understand correctly what you need is a system which is basically
>> based on booklet-printing but each booklet should be restricted to 16
>> pages.  In this case you might try
>> 
>> \setuparranging[2*2*4]
>> 
>> This scheme put two pages on the front and two pages on the backside
>> of a sheet of paper. Then it uses 4 sheets to complete the section.
>> 
>> Willi
> 
> Hello Willi, thanks for your reply.
> 
> No, the scheme is quite complicated (from 1 to 16) because the pages are
> first folded, then the two *folded* sheets are inserted one into the
> other, and then signature is bound and trimmed.
> 
> So the scheme looks so (R means rotated 180°):
> 
> 
> 13 R | 4 R
> -----------     
> 16   |  1
> 
> 
> 3 R  | 14 R
> -----------
> 2    | 15
> 
> 
> 9 R  | 8 R
> -----------
> 12   |  5
> 
> 7R   | 10R
> ----------
> 6    |  11
> 
> 
> Yes, that's crazy (if you ask me). As I said, I'll go with the layers
> and a perl helper, the outcome looks almost fine.
> 
> Best wishes
> 
> -- 
> Marco
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 20:21     ` Willi Egger
@ 2012-05-29 22:16       ` Marco Pessotto
  2012-05-30  8:44         ` Marco Pessotto
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Pessotto @ 2012-05-29 22:16 UTC (permalink / raw)
  To: ntg-context

Willi Egger <context@boede.nl> writes:

> To my knowledge the printer will have more hand-work than accepting
> that e.g. the 2*4*2 or the 2*2*4 scheme is used. - Again, if I
> understand you correctly, then the folding machine can only do a
> single fold. So after assembling the section with two folded sheets
> still a manual fold must be made along the spine. I expect that the
> assembly is quite unstable if it has to be stitched/sewn.
>
>  In the first case one can pick two sheets and fold them twice,
>  resulting in a 16 pages section. Such folded sections are stable for
>  stitching/sewing.  Even more easy is the 2*2*4 approach, with a
>  single folding over the spine you end up with a section of 16
>  pages. This kind of section is reasonably stable for
>  stitching/sewing.

Hi Willi,

thanks for your truly inshightful reply. I'll discuss this with the
people doing the printing/folding/binding, because, as you noted,
something here doesn't feel right.

Thanks again

Best wishes

-- 
Marco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
  2012-05-29 22:16       ` Marco Pessotto
@ 2012-05-30  8:44         ` Marco Pessotto
  0 siblings, 0 replies; 8+ messages in thread
From: Marco Pessotto @ 2012-05-30  8:44 UTC (permalink / raw)
  To: ntg-context


As a follow-up, just in case someone will search the archive for a
similar problem, this is my “solution”, regardless of the question if
the imposition scheme is really suitable for binding or not. It's quite
an hack, but it seems to work and is way simpler for a profane like me
to create a custom imposition schema (code below). I dropped the
ConTeXt-based solution with layers because of the amount of work
required to bootstrap it.

As a side note, I stumbled in a psutils bug (no surprise, the version on
the CTAN is *12* years old), where the %%BoundingBox and %%DocumentMedia
header where inserted correctly, but the original preserved, leading to
viewer (and even printer?) to believe the PS had still the old
dimensions (so I removed them with sed before passing it to pstops).

Cheers

#!/bin/bash

set -e
set -o pipefail
# avoid to use polluted path, or the debug will be impossible
export PATH=/usr/bin:/bin

# the input document should have exactly the width set to half of
# this, and the height set to half too, which means 16cmx22cm. Paper
# is 32cm x 44cm
width=907
height=1247

# usual check
if [ ! -f "$1" ]; then
    echo "$1 is not a file, exiting"
    exit
fi

# naming convention
input=$1
output=${input%%.pdf}-imposed.pdf

# the scheme: U means rotated 180°, the parens indicate the shifting
# after the rotation. We use the w and h flag to avoid math :-)
# pages are numbered from 0.

p1="15(0,0)+0(0.5w,0)+12U(0.5w,1h)+3U(1w,1h)"
p2="1(0,0)+14(0.5w,0)+2U(0.5w,1h)+13U(1w,1h)"
p3="11(0,0)+4(0.5w,0)+8U(0.5w,1h)+7U(1w,1h)"
p4="5(0,0)+10(0.5w,0)+6U(0.5w,1h)+9U(1w,1h)"


# the sed string is needed to avoid a broken DSC

pdftops -level3 "$input" - | \
    sed -e '/^%%BoundingBox:/d' -e '/^%%DocumentMedia:/d' | \
    pstops -b -w$width -h$height \
    "16:$p1,$p2,$p3,$p4" | \
    ps2pdf -dPDFSETTINGS=/prepress \
    -dDEVICEWIDTHPOINTS=$width -dDEVICEHEIGHTPOINTS=$height \
    - "$output"
pdfinfo "$output"
pdffonts "$output"
echo "$input => $output"
exit 0

-- 
Marco

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-05-30  8:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-29 17:06 Is it possible to define a custom imposition schema? (sure it is, but how?) Marco Pessotto
2012-05-29 17:13 ` Hans Hagen
2012-05-29 18:54   ` Marco Pessotto
2012-05-29 18:04 ` Willi Egger
2012-05-29 19:00   ` Marco Pessotto
2012-05-29 20:21     ` Willi Egger
2012-05-29 22:16       ` Marco Pessotto
2012-05-30  8:44         ` Marco Pessotto

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).