40
|
1 |
#!/bin/env python
|
|
2 |
###############################################################################
|
|
3 |
#
|
|
4 |
# ReportLab Public License Version 1.0
|
|
5 |
#
|
|
6 |
# Except for the change of names the spirit and intention of this
|
|
7 |
# license is the same as that of Python
|
|
8 |
#
|
|
9 |
# (C) Copyright ReportLab Inc. 1998-2000.
|
|
10 |
#
|
|
11 |
# adapted with permission from PIDDLE, original author Joe Strout
|
|
12 |
#
|
|
13 |
# All Rights Reserved
|
|
14 |
#
|
|
15 |
# Permission to use, copy, modify, and distribute this software and its
|
|
16 |
# documentation for any purpose and without fee is hereby granted, provided
|
|
17 |
# that the above copyright notice appear in all copies and that both that
|
|
18 |
# copyright notice and this permission notice appear in supporting
|
|
19 |
# documentation, and that the name of ReportLab not be used
|
|
20 |
# in advertising or publicity pertaining to distribution of the software
|
|
21 |
# without specific, written prior permission.
|
|
22 |
#
|
|
23 |
#
|
|
24 |
# Disclaimer
|
|
25 |
#
|
|
26 |
# ReportLab Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
27 |
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
|
28 |
# IN NO EVENT SHALL ReportLab BE LIABLE FOR ANY SPECIAL, INDIRECT
|
|
29 |
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
30 |
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
31 |
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32 |
# PERFORMANCE OF THIS SOFTWARE.
|
|
33 |
#
|
|
34 |
###############################################################################
|
|
35 |
# $Log: pagesizes.py,v $
|
169
|
36 |
# Revision 1.3 2000/04/26 11:13:28 andy_robinson
|
|
37 |
# Fixed some broken pagesizes and added a
|
|
38 |
# landscape() function.
|
|
39 |
#
|
44
|
40 |
# Revision 1.2 2000/03/08 13:40:49 rgbecker
|
|
41 |
# Added DEFAULT_PAGE_SIZE at end
|
169
|
42 |
#
|
40
|
43 |
# Revision 1.1 2000/03/08 12:55:07 andy_robinson
|
|
44 |
# initial checkin
|
44
|
45 |
#
|
40
|
46 |
|
|
47 |
"""This module defines a few common page sizes in points (1/72 inch).
|
|
48 |
To be expanded to include things like label sizes, envelope windows
|
|
49 |
etc."""
|
169
|
50 |
__version__=''' $Id: pagesizes.py,v 1.3 2000/04/26 11:13:28 andy_robinson Exp $ '''
|
40
|
51 |
|
|
52 |
from units import cm, inch
|
|
53 |
|
|
54 |
_W, _H = (21*cm, 29.7*cm)
|
|
55 |
|
|
56 |
A6 = (_W*.5, _H*.5)
|
|
57 |
A5 = (_H*.5, _W)
|
|
58 |
A4 = (_W, _H)
|
169
|
59 |
A3 = (_H, _W*2)
|
40
|
60 |
A2 = (_W*2, _H*2)
|
169
|
61 |
A1 = (_H*2, _W*4)
|
40
|
62 |
A0 = (_W*4, _H*4)
|
|
63 |
|
|
64 |
letter = (8.5*inch, 11*inch)
|
|
65 |
legal = (8.5*inch, 17*inch)
|
|
66 |
elevenSeventeen = (11*inch, 17*inch)
|
|
67 |
|
|
68 |
_BW, _BH = (25*cm, 35.3*cm)
|
|
69 |
B6 = (_BW*.5, _BH*.5)
|
|
70 |
B5 = (_BH*.5, _BW)
|
|
71 |
B4 = (_BW, _BH)
|
|
72 |
B3 = (_BH*2, _BW)
|
|
73 |
B2 = (_BW*2, _BH*2)
|
|
74 |
B1 = (_BH*4, _BW*2)
|
|
75 |
B0 = (_BW*4, _BH*4)
|
|
76 |
|
44
|
77 |
#change this to suit your average needs
|
|
78 |
DEFAULT_PAGE_SIZE = A4
|
169
|
79 |
|
|
80 |
def landscape(pagesize):
|
|
81 |
"""Use this to invert any pagesize"""
|
|
82 |
return (pagesize[1], pagesize[0])
|
|
83 |
|