1
# -*- mode: python ; coding: utf-8 -*-
9
def postersamples(pages_h, pages_v, which,
11
numpages=0, reverse=False,
12
rotate=False, scale_to=100):
13
inputfile = 'testpage-%s.pdf' % which
14
geo = '%ix%ia4' % (pages_h, pages_v)
16
poster = env.Command('poster-%s-%s.pdf' % (which, geo),
18
'pdfposter -ma4 -p$POSTERSIZE $SOURCE $TARGET',
21
# montage the ppm imgages to show how they have to be glued together
22
tiles_h = tiles_h or pages_h
23
rotate = rotate and ' png:- | convert png:- -rotate -90 ' or ''
26
# this is lazy: better way would be to get the number of pages
27
# from 'poster', but this would requier an extra builder
28
numpages = numpages or pages_h*pages_v
29
page_range = repr( range(numpages-1, -1, -1)).replace(' ', '')
30
env.Command('poster-%s-%s.png' % (which, geo), poster,
31
"montage $SOURCE$RANGE "
32
" -background '#336699' -geometry ${SCALE}x+2+2 "
35
P_COLS=tiles_h, ROTATE=rotate, SCALE=scale_to,
37
env.Command('testpage-tall.png', 'testpage-tall.pdf',
38
"convert $SOURCE -background '#336699' $TARGET")
39
env.Command('testpage-wide.png', 'testpage-wide.pdf',
40
"convert $SOURCE -background '#336699' $TARGET")
42
# tall on two landscape sheets
43
postersamples(1, 2, 'tall', reverse=1)
44
# tall on two portrait sheets
45
postersamples(2, 1, 'tall', rotate=0)
47
# wide on two landscape sheets
48
postersamples(1, 2, 'wide', rotate=0)
49
# wide on two portrait sheets
50
postersamples(2, 1, 'wide')
52
# wide on landscape sheets (landscape a4 heigh)
53
postersamples(1, 99, 'wide', scale_to=50, rotate=1)
54
# wide on portrait sheets (portrait a4 heigh)
55
postersamples(99, 1, 'wide', scale_to=50, tiles_h=9)