~ubuntu-branches/ubuntu/trusty/pdfposter/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/SConscript

  • Committer: Package Import Robot
  • Author(s): Elena Grandi, Jakub Wilk, Elena Grandi
  • Date: 2013-05-22 10:03:38 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130522100338-26uo6rmqsurfcfzv
Tags: 0.6.0-1
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Elena Grandi ]
* New upstream release
* Regenerate PDF files from python sources
* Include html documentation
* Updated homepage and author contacts
* debian/control: bump Standards-Version to 3.9.3 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- mode: python ; coding: utf-8 -*-
2
 
#
3
 
# Build requirements
4
 
# - ImageMagick
5
 
#
6
 
 
7
 
Import('*')
8
 
 
9
 
def postersamples(pages_h, pages_v, which,
10
 
                  tiles_h=0,
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)
15
 
    # create pdf poster
16
 
    poster = env.Command('poster-%s-%s.pdf' % (which, geo),
17
 
                         inputfile,
18
 
                         'pdfposter -ma4 -p$POSTERSIZE $SOURCE $TARGET',
19
 
                         POSTERSIZE=geo)[0]
20
 
 
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 ''
24
 
    page_range = ''
25
 
    if reverse:
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 "
33
 
                " -tile $P_COLS "
34
 
                " $ROTATE $TARGET",
35
 
                P_COLS=tiles_h, ROTATE=rotate, SCALE=scale_to,
36
 
                RANGE=page_range)
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")
41
 
 
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)
46
 
 
47
 
# wide on two landscape sheets
48
 
postersamples(1, 2, 'wide', rotate=0)
49
 
# wide on two portrait sheets
50
 
postersamples(2, 1, 'wide')
51
 
 
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)