ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco Pessotto <melmothx@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Is it possible to define a custom imposition schema? (sure it is, but how?)
Date: Wed, 30 May 2012 10:44:52 +0200	[thread overview]
Message-ID: <87y5oaqcqj.fsf@universe.krase.net> (raw)
In-Reply-To: <87ehq2vdj9.fsf@universe.krase.net>


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
___________________________________________________________________________________

      reply	other threads:[~2012-05-30  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 17:06 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 message]

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=87y5oaqcqj.fsf@universe.krase.net \
    --to=melmothx@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).