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
}{file, *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
}{file, *args, **kwargs
}
51 Write
\class{document} to a PS file, passing
\var{args
} and
52 \var{kwargs
} to the
\class{pswriter
} instance created for writing.
55 \begin{methoddesc
}{writePDFfile
}{file, *args, **kwargs
}
56 Write
\class{document} to a PDF file, passing
\var{args
} and
57 \var{kwargs
} to the
\class{pdfwriter
} instance created for writing.
60 \begin{methoddesc
}{writetofile
}{filename, *args, **kwargs
}
61 Determine the file type (EPS, PS, or PDF) from the file extension
62 of
\var{filename
} and call the corresponding write method with
63 the given arguments
\var{arg
} and
\var{kwargs
}.
66 \subsection{Class
\class{paperformat
}}
68 \begin{classdesc
}{paperformat
}{width, height, name=None
}
69 Define a
\class{paperformat
} with the given
\var{width
} and
70 \var{height
} and the optional
\var{name
}.
73 Predefined paperformats are listed in the following table
76 \begin{tabular
}{l|l|l|l
}
77 instance & name & width & height \\
79 \constant{document.paperformat.A0
} & A0 &
\unit[840]{mm
} &
81 \constant{document.paperformat.A0b
} & &
\unit[910]{mm
} &
83 \constant{document.paperformat.A1
} & A1&
\unit[594]{mm
} &
85 \constant{document.paperformat.A2
} & A2&
\unit[420]{mm
} &
87 \constant{document.paperformat.A3
} & A3 &
\unit[297]{mm
} &
\unit[420]{mm
}\\
88 \constant{document.paperformat.A4
} & A4&
\unit[210]{mm
} &
\unit[297]{mm
}\\
89 \constant{document.paperformat.Letter
} & Letter &
\unit[8.5]{inch
} &
91 \constant{document.paperformat.Legal
} & Legal &
\unit[8.5]{inch
} &
\unit[14]{inch
}
100 %%% TeX-master: "manual.tex"