1 \section{Module
\module{document}}
4 \sectionauthor{J\"org Lehmann
}{joergl@users.sourceforge.net
}
6 \declaremodule{}{document}
10 The
document module contains two classes:
\class{document} and
11 \class{page
}. A
\class{document} consists of one or several
15 \subsection{Class
\class{page
}}
17 A
\class{page
} is a thin wrapper around a
\class{canvas
}, which
18 defines some additional properties of the page.
20 \begin{classdesc
}{page
}{canvas, pagename=None,
21 paperformat=paperformat.A4, rotated=
0, centered=
1, fittosize=
0,
22 margin=
1 * unit.t_cm, bboxenlarge=
1 * unit.t_pt, bbox=None
}
23 Construct a new
\class{page
} from the given
\class{canvas
} instance.
24 A string
\var{pagename
} and the
\var{paperformat
} can be
25 defined. See below, for a list of known paper formats.
26 If
\var{rotated
} is set, the output is rotated by
90 degrees on the
27 page. If
\var{centered
} is set, the output is centered on the given
28 paperformat. If
\var{fittosize
} is set, the output is scaled to fill
29 the full page except for a given
\var{margin
}.
30 Normally, the bounding box of the canvas is calculated automatically
31 from the bounding box of its elements. Alternatively, you may
32 specify the
\var{bbox
} manually. In any case, the bounding box is
33 enlarged on all sides by
\var{bboxenlarge
}.
36 \subsection{Class
\class{document}}
38 \begin{classdesc
}{document}{pages=
[]}
39 Construct a
\class{document} consisting of a given list of
\var{pages
}.
42 A
\class{document} can be written to a file using one of the following methods:
44 \begin{methoddesc
}{writeEPSfile
}{filename, *args, **kwargs
}
45 Write a single page
\class{document} to an EPS file, passing
46 \var{args
} and
\var{kwargs
} to the
\class{epswriter
} instance
50 \begin{methoddesc
}{writePSfile
}{filename, *args, **kwargs
}
51 Write a single page
\class{document} to a PS file, passing
52 \var{args
} and
\var{kwargs
} to the
\class{pswriter
} instance
56 \begin{methoddesc
}{writePDFfile
}{filename, *args, **kwargs
}
57 Write a single page
\class{document} to a PDS file, passing
58 \var{args
} and
\var{kwargs
} to the
\class{pdfwriter
} instance
62 \begin{methoddesc
}{writetofile
}{filename, *args, **kwargs
}
63 Determine the file type (EPS, PS, or PDF) from the file extension
64 of
\var{filename
} and call the corresponding write method with
65 the given arguments
\var{arg
} and
\var{kwargs
}.
68 \subsection{Class
\class{paperformat
}}
70 \begin{classdesc
}{paperformat
}{width, height, name=None
}
71 Define a
\class{paperformat
} with the given
\var{width
} and
72 \var{height
} and the optional
\var{name
}.
75 Predefined paperformats are listed in the following table
78 \begin{tabular
}{l|l|l|l
}
79 instance & name & width & height \\
81 \constant{document.paperformat.A0
} & A0 &
\unit[840]{mm
} &
83 \constant{document.paperformat.A0b
} & &
\unit[910]{mm
} &
85 \constant{document.paperformat.A1
} & A1&
\unit[594]{mm
} &
87 \constant{document.paperformat.A2
} & A2&
\unit[420]{mm
} &
89 \constant{document.paperformat.A3
} & A3 &
\unit[297]{mm
} &
\unit[420]{mm
}\\
90 \constant{document.paperformat.A4
} & A4&
\unit[210]{mm
} &
\unit[297]{mm
}\\
91 \constant{document.paperformat.Letter
} & Letter &
\unit[8.5]{inch
} &
93 \constant{document.paperformat.Legal
} & Legal &
\unit[8.5]{inch
} &
\unit[14]{inch
}
102 %%% TeX-master: "manual.tex"