author | rgbecker |
Thu, 20 Jul 2000 16:41:16 +0000 | |
changeset 405 | 8ee871d827a2 |
parent 339 | e6ccd2f83f6c |
child 494 | 54257447cfe9 |
permissions | -rw-r--r-- |
197 | 1 |
############################################################################### |
2 |
# |
|
3 |
# ReportLab Public License Version 1.0 |
|
4 |
# |
|
305 | 5 |
# Except for the change of names the spirit and intention of this |
6 |
# license is the same as that of Python |
|
197 | 7 |
# |
8 |
# (C) Copyright ReportLab Inc. 1998-2000. |
|
9 |
# |
|
10 |
# |
|
11 |
# All Rights Reserved |
|
12 |
# |
|
13 |
# Permission to use, copy, modify, and distribute this software and its |
|
14 |
# documentation for any purpose and without fee is hereby granted, provided |
|
15 |
# that the above copyright notice appear in all copies and that both that |
|
16 |
# copyright notice and this permission notice appear in supporting |
|
17 |
# documentation, and that the name of ReportLab not be used |
|
18 |
# in advertising or publicity pertaining to distribution of the software |
|
19 |
# without specific, written prior permission. |
|
20 |
# |
|
21 |
# |
|
22 |
# Disclaimer |
|
23 |
# |
|
24 |
# ReportLab Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
|
25 |
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, |
|
26 |
# IN NO EVENT SHALL ReportLab BE LIABLE FOR ANY SPECIAL, INDIRECT |
|
27 |
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
|
28 |
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|
29 |
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
30 |
# PERFORMANCE OF THIS SOFTWARE. |
|
31 |
# |
|
32 |
############################################################################### |
|
33 |
# $Log: doctemplate.py,v $ |
|
405 | 34 |
# Revision 1.28 2000/07/20 16:41:16 rgbecker |
35 |
# Added pagesize to canvasmaker call |
|
36 |
# |
|
339 | 37 |
# Revision 1.27 2000/07/10 11:58:35 andy_robinson |
38 |
# Pre-incrementing bug fixed |
|
405 | 39 |
# |
332 | 40 |
# Revision 1.26 2000/07/07 16:21:12 rgbecker |
41 |
# Cosmetics |
|
339 | 42 |
# |
325 | 43 |
# Revision 1.25 2000/07/06 12:40:37 rgbecker |
44 |
# Push canvas into flowables during wrap/split |
|
332 | 45 |
# |
322 | 46 |
# Revision 1.24 2000/07/05 12:22:21 rgbecker |
47 |
# Force _calc in SimpleDocTemplae.build |
|
325 | 48 |
# |
316 | 49 |
# Revision 1.23 2000/07/03 15:39:51 rgbecker |
50 |
# Documentation fixes |
|
322 | 51 |
# |
310 | 52 |
# Revision 1.22 2000/06/28 14:52:43 rgbecker |
53 |
# Documentation changes |
|
316 | 54 |
# |
305 | 55 |
# Revision 1.21 2000/06/26 15:58:22 rgbecker |
56 |
# Simple fix to widths problem |
|
310 | 57 |
# |
305 | 58 |
# Revision 1.20 2000/06/21 12:27:42 rgbecker |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
59 |
# remove UserDocTemplate, but add Andy's hook methods |
305 | 60 |
# |
61 |
# Revision 1.19 2000/06/20 21:56:17 andy_robinson |
|
294 | 62 |
# re-synching after sourceforge went weird |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
63 |
# |
305 | 64 |
# Revision 1.18 2000/06/19 23:51:23 andy_robinson |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
65 |
# Added UserDocTemplate class, and paragraph.getPlainText() |
294 | 66 |
# |
305 | 67 |
# Revision 1.17 2000/06/19 11:14:03 andy_robinson |
279 | 68 |
# Global sequencer put in the 'story builder'. |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
69 |
# |
305 | 70 |
# Revision 1.16 2000/06/16 13:49:20 aaron_watters |
272
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
71 |
# new build parameters to allow alternate filename and canvas implementation |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
72 |
# (in order to support slideshow summary mode, for example, or embedding one |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
73 |
# document in another). |
279 | 74 |
# |
305 | 75 |
# Revision 1.15 2000/06/13 13:03:31 aaron_watters |
268 | 76 |
# more documentation changes |
272
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
77 |
# |
305 | 78 |
# Revision 1.14 2000/06/01 16:27:56 rgbecker |
255 | 79 |
# pageSize is wrong at present |
268 | 80 |
# |
305 | 81 |
# Revision 1.13 2000/06/01 15:23:06 rgbecker |
253 | 82 |
# Platypus re-organisation |
255 | 83 |
# |
305 | 84 |
# Revision 1.12 2000/05/26 10:27:37 rgbecker |
249 | 85 |
# Fixed infinite recursion bug |
253 | 86 |
# |
305 | 87 |
# Revision 1.11 2000/05/17 22:17:38 rgbecker |
227 | 88 |
# Renamed BasicFrame to Frame |
249 | 89 |
# |
305 | 90 |
# Revision 1.10 2000/05/17 16:29:40 rgbecker |
226 | 91 |
# Removal of SimpleFrame |
227 | 92 |
# |
225 | 93 |
# Revision 1.9 2000/05/17 15:37:33 rgbecker |
94 |
# Changes related to removal of SimpleFlowDocument |
|
226 | 95 |
# |
221 | 96 |
# Revision 1.8 2000/05/16 16:15:16 rgbecker |
97 |
# Changes related to removal of SimpleFlowDocument |
|
225 | 98 |
# |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
99 |
# Revision 1.7 2000/05/16 14:28:55 rgbecker |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
100 |
# Fixes/Changes to get testplatypus to work with new framework |
221 | 101 |
# |
214 | 102 |
# Revision 1.6 2000/05/15 15:07:32 rgbecker |
103 |
# Added drawPage |
|
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
104 |
# |
206 | 105 |
# Revision 1.5 2000/05/13 08:33:53 rgbecker |
106 |
# fix typo in import |
|
214 | 107 |
# |
204 | 108 |
# Revision 1.4 2000/05/12 16:21:02 rgbecker |
109 |
# _donothing explicit import |
|
206 | 110 |
# |
200 | 111 |
# Revision 1.3 2000/05/12 14:53:38 rgbecker |
112 |
# Handle splitting error in build |
|
204 | 113 |
# |
199 | 114 |
# Revision 1.2 2000/05/12 14:45:31 rgbecker |
115 |
# Single actions only in ActionFlowables |
|
200 | 116 |
# |
197 | 117 |
# Revision 1.1 2000/05/12 12:53:33 rgbecker |
118 |
# Initial try at a document template class |
|
199 | 119 |
# |
405 | 120 |
__version__=''' $Id: doctemplate.py,v 1.28 2000/07/20 16:41:16 rgbecker Exp $ ''' |
197 | 121 |
__doc__=""" |
268 | 122 |
This module contains the core structure of platypus. |
123 |
||
305 | 124 |
Platypus constructs documents. Document styles are determined by DocumentTemplates. |
268 | 125 |
|
126 |
Each DocumentTemplate contains one or more PageTemplates which defines the look of the |
|
127 |
pages of the document. |
|
128 |
||
129 |
Each PageTemplate has a procedure for drawing the "non-flowing" part of the page |
|
130 |
(for example the header, footer, page number, fixed logo graphic, watermark, etcetera) and |
|
131 |
a set of Frames which enclose the flowing part of the page (for example the paragraphs, |
|
132 |
tables, or non-fixed diagrams of the text). |
|
133 |
||
134 |
A document is built when a DocumentTemplate is fed a sequence of Flowables. |
|
135 |
The action of the build consumes the flowables in order and places them onto |
|
136 |
frames on pages as space allows. When a frame runs out of space the next frame |
|
137 |
of the page is used. If no frame remains a new page is created. A new page |
|
138 |
can also be created if a page break is forced. |
|
139 |
||
140 |
The special invisible flowable NextPageTemplate can be used to specify |
|
141 |
the page template for the next page (which by default is the one being used |
|
142 |
for the current frame). |
|
197 | 143 |
""" |
279 | 144 |
from reportlab.platypus.flowables import * |
145 |
from reportlab.platypus.paragraph import Paragraph |
|
146 |
from reportlab.platypus.frames import Frame |
|
147 |
import reportlab.lib.sequencer |
|
197 | 148 |
from types import * |
149 |
import sys |
|
150 |
||
253 | 151 |
def _doNothing(canvas, doc): |
152 |
"Dummy callback for onPage" |
|
153 |
pass |
|
154 |
||
197 | 155 |
class ActionFlowable(Flowable): |
268 | 156 |
'''This Flowable is never drawn, it can be used for data driven controls |
157 |
For example to change a page template (from one column to two, for example) |
|
158 |
use NextPageTemplate which creates an ActionFlowable. |
|
159 |
''' |
|
199 | 160 |
def __init__(self,action=[]): |
161 |
if type(action) not in (ListType, TupleType): |
|
162 |
action = (action,) |
|
163 |
self.action = action |
|
197 | 164 |
|
165 |
def wrap(self, availWidth, availHeight): |
|
316 | 166 |
'''Should never be called.''' |
197 | 167 |
raise NotImplementedError |
168 |
||
169 |
def draw(self): |
|
316 | 170 |
'''Should never be called.''' |
197 | 171 |
raise NotImplementedError |
172 |
||
173 |
def apply(self,doc): |
|
316 | 174 |
''' |
175 |
This is called by the doc.build processing to allow the instance to |
|
176 |
implement its behaviour |
|
177 |
''' |
|
199 | 178 |
action = self.action[0] |
179 |
args = tuple(self.action[1:]) |
|
255 | 180 |
arn = 'handle_'+action |
199 | 181 |
try: |
255 | 182 |
apply(getattr(doc,arn), args) |
183 |
except AttributeError, aerr: |
|
184 |
if aerr.args[0]==arn: |
|
185 |
raise NotImplementedError, "Can't handle ActionFlowable(%s)" % action |
|
186 |
else: |
|
187 |
raise |
|
268 | 188 |
except "bogus": |
199 | 189 |
t, v, None = sys.exc_info() |
305 | 190 |
raise t, "%s\n handle_%s args=%s"%(v,action,args) |
197 | 191 |
|
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
192 |
def __call__(self): |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
193 |
return self |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
194 |
|
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
195 |
FrameBreak = ActionFlowable('frameEnd') |
197 | 196 |
PageBegin = ActionFlowable('pageBegin') |
197 |
||
198 |
class NextPageTemplate(ActionFlowable): |
|
268 | 199 |
"""When you get to the next page, use the template specified (change to two column, for example) """ |
197 | 200 |
def __init__(self,pt): |
199 | 201 |
ActionFlowable.__init__(self,('nextPageTemplate',pt)) |
197 | 202 |
|
203 |
class PageTemplate: |
|
204 |
""" |
|
227 | 205 |
essentially a list of Frames and an onPage routine to call at the start |
332 | 206 |
of a page when this is selected. onPageEnd gets called at the end. |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
207 |
derived classes can also implement beforeDrawPage and afterDrawPage if they want |
197 | 208 |
""" |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
209 |
def __init__(self,id=None,frames=[],onPage=_doNothing, onPageEnd=_doNothing): |
197 | 210 |
if type(frames) not in (ListType,TupleType): frames = [frames] |
227 | 211 |
assert filter(lambda x: not isinstance(x,Frame), frames)==[], "frames argument error" |
197 | 212 |
self.id = id |
213 |
self.frames = frames |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
214 |
self.onPage = onPage |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
215 |
self.onPageEnd = onPageEnd |
197 | 216 |
|
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
217 |
def beforeDrawPage(self,canv,doc): |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
218 |
"""Override this if you want additional functionality or prefer |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
219 |
a class based page routine. Called before any flowables for |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
220 |
this page are processed.""" |
214 | 221 |
pass |
222 |
||
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
223 |
def afterDrawPage(self, canv, doc): |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
224 |
"""This is called after the last flowable for the page has |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
225 |
been processed. You might use this if the page header or |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
226 |
footer needed knowledge of what flowables were drawn on |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
227 |
this page.""" |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
228 |
pass |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
229 |
|
197 | 230 |
class BaseDocTemplate: |
231 |
""" |
|
232 |
First attempt at defining a document template class. |
|
233 |
||
234 |
The basic idea is simple. |
|
235 |
0) The document has a list of data associated with it |
|
236 |
this data should derive from flowables. We'll have |
|
237 |
special classes like PageBreak, FrameBreak to do things |
|
238 |
like forcing a page end etc. |
|
239 |
||
240 |
1) The document has one or more page templates. |
|
241 |
||
242 |
2) Each page template has one or more frames. |
|
243 |
||
244 |
3) The document class provides base methods for handling the |
|
245 |
story events and some reasonable methods for getting the |
|
246 |
story flowables into the frames. |
|
247 |
||
248 |
4) The document instances can override the base handler routines. |
|
268 | 249 |
|
250 |
Most of the methods for this class are not called directly by the user, |
|
251 |
but in some advanced usages they may need to be overridden via subclassing. |
|
252 |
||
253 |
EXCEPTION: doctemplate.build(...) must be called for most reasonable uses |
|
254 |
since it builds a document using the page template. |
|
255 |
||
310 | 256 |
Each document template builds exactly one document into a file specified |
257 |
by the filename argument on initialization. |
|
258 |
||
268 | 259 |
Possible keyword arguments for the initialization: |
260 |
||
305 | 261 |
pageTemplates: A list of templates. Must be nonempty. Names |
268 | 262 |
assigned to the templates are used for referring to them so no two used |
305 | 263 |
templates should have the same name. For example you might want one template |
268 | 264 |
for a title page, one for a section first page, one for a first page of |
265 |
a chapter and two more for the interior of a chapter on odd and even pages. |
|
266 |
If this argument is omitted then at least one pageTemplate should be provided |
|
267 |
using the addPageTemplates method before the document is built. |
|
310 | 268 |
showBoundary: if set draw a box around the frame boundaries. |
268 | 269 |
leftMargin: |
270 |
rightMargin: |
|
271 |
topMargin: |
|
272 |
bottomMargin: Margin sizes in points (default 1 inch) |
|
273 |
These margins may be overridden by the pageTemplates. They are primarily of interest |
|
274 |
for the SimpleDocumentTemplate subclass. |
|
275 |
allowSplitting: If set flowables (eg, paragraphs) may be split across frames or pages |
|
276 |
(default: 1) |
|
277 |
title: Internal title for document (does not automatically display on any page) |
|
278 |
author: Internal author for document (does not automatically display on any page) |
|
197 | 279 |
""" |
255 | 280 |
_initArgs = { 'pagesize':DEFAULT_PAGE_SIZE, |
253 | 281 |
'pageTemplates':[], |
282 |
'showBoundary':0, |
|
283 |
'leftMargin':inch, |
|
284 |
'rightMargin':inch, |
|
285 |
'topMargin':inch, |
|
286 |
'bottomMargin':inch, |
|
287 |
'allowSplitting':1, |
|
288 |
'title':None, |
|
289 |
'author':None, |
|
290 |
'_pageBreakQuick':1} |
|
291 |
_invalidInitArgs = () |
|
197 | 292 |
|
253 | 293 |
def __init__(self, filename, **kw): |
268 | 294 |
"""create a document template bound to a filename (see class documentation for keyword arguments)""" |
197 | 295 |
self.filename = filename |
253 | 296 |
|
297 |
for k in self._initArgs.keys(): |
|
298 |
if not kw.has_key(k): |
|
299 |
v = self._initArgs[k] |
|
300 |
else: |
|
301 |
if k in self._invalidInitArgs: |
|
302 |
raise ValueError, "Invalid argument %s" % k |
|
303 |
v = kw[k] |
|
304 |
setattr(self,k,v) |
|
305 |
||
306 |
p = self.pageTemplates |
|
307 |
self.pageTemplates = [] |
|
308 |
self.addPageTemplates(p) |
|
309 |
self._calc() |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
310 |
self.afterInit() |
279 | 311 |
|
253 | 312 |
def _calc(self): |
255 | 313 |
self._rightMargin = self.pagesize[0] - self.rightMargin |
314 |
self._topMargin = self.pagesize[1] - self.topMargin |
|
253 | 315 |
self.width = self._rightMargin - self.leftMargin |
316 |
self.height = self._topMargin - self.bottomMargin |
|
197 | 317 |
|
318 |
def clean_hanging(self): |
|
249 | 319 |
'handle internal postponed actions' |
197 | 320 |
while len(self._hanging): |
321 |
self.handle_flowable(self._hanging) |
|
322 |
||
323 |
def addPageTemplates(self,pageTemplates): |
|
268 | 324 |
'add one or a sequence of pageTemplates' |
197 | 325 |
if type(pageTemplates) not in (ListType,TupleType): |
326 |
pageTemplates = [pageTemplates] |
|
327 |
assert filter(lambda x: not isinstance(x,PageTemplate), pageTemplates)==[], "pageTemplates argument error" |
|
328 |
for t in pageTemplates: |
|
329 |
self.pageTemplates.append(t) |
|
330 |
||
331 |
def handle_documentBegin(self): |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
332 |
'''implement actions at beginning of document''' |
197 | 333 |
self._hanging = [PageBegin] |
334 |
self.pageTemplate = self.pageTemplates[0] |
|
335 |
self.page = 0 |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
336 |
self.beforeDocument() |
197 | 337 |
|
338 |
def handle_pageBegin(self): |
|
249 | 339 |
'''Perform actions required at beginning of page. |
340 |
shouldn't normally be called directly''' |
|
197 | 341 |
self.page = self.page + 1 |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
342 |
self.pageTemplate.beforeDrawPage(self.canv,self) |
197 | 343 |
self.pageTemplate.onPage(self.canv,self) |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
344 |
self.beforePage() |
197 | 345 |
if hasattr(self,'_nextFrameIndex'): |
346 |
del self._nextFrameIndex |
|
347 |
self.frame = self.pageTemplate.frames[0] |
|
348 |
self.handle_frameBegin() |
|
349 |
||
350 |
def handle_pageEnd(self): |
|
351 |
''' show the current page |
|
352 |
check the next page template |
|
353 |
hang a page begin |
|
354 |
''' |
|
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
355 |
self.pageTemplate.afterDrawPage(self.canv, self) |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
356 |
self.pageTemplate.onPageEnd(self.canv, self) |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
357 |
self.afterPage() |
197 | 358 |
self.canv.showPage() |
359 |
if hasattr(self,'_nextPageTemplateIndex'): |
|
360 |
self.pageTemplate = self.pageTemplates[self._nextPageTemplateIndex] |
|
361 |
del self._nextPageTemplateIndex |
|
362 |
self._hanging.append(PageBegin) |
|
363 |
||
364 |
def handle_pageBreak(self): |
|
365 |
'''some might choose not to end all the frames''' |
|
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
366 |
if self._pageBreakQuick: |
197 | 367 |
self.handle_pageEnd() |
368 |
else: |
|
369 |
n = len(self._hanging) |
|
370 |
while len(self._hanging)==n: |
|
371 |
self.handle_frameEnd() |
|
372 |
||
373 |
def handle_frameBegin(self,*args): |
|
249 | 374 |
'''What to do at the beginning of a page''' |
197 | 375 |
self.frame._reset() |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
376 |
if self.showBoundary or self.frame.showBoundary: |
226 | 377 |
self.frame.drawBoundary(self.canv) |
197 | 378 |
|
379 |
def handle_frameEnd(self): |
|
380 |
''' Handles the semantics of the end of a frame. This includes the selection of |
|
381 |
the next frame or if this is the last frame then invoke pageEnd. |
|
382 |
''' |
|
383 |
if hasattr(self,'_nextFrameIndex'): |
|
384 |
frame = self.pageTemplate.frames[self._nextFrameIndex] |
|
385 |
del self._nextFrameIndex |
|
204 | 386 |
self.handle_frameBegin() |
197 | 387 |
elif hasattr(self.frame,'lastFrame') or self.frame is self.pageTemplate.frames[-1]: |
388 |
self.handle_pageEnd() |
|
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
389 |
self.frame = None |
197 | 390 |
else: |
391 |
f = self.frame |
|
392 |
self.frame = self.pageTemplate.frames[self.pageTemplate.frames.index(f) + 1] |
|
393 |
self.handle_frameBegin() |
|
394 |
||
395 |
def handle_nextPageTemplate(self,pt): |
|
396 |
'''On endPage chenge to the page template with name or index pt''' |
|
397 |
if type(pt) is StringType: |
|
398 |
for t in self.pageTemplates: |
|
399 |
if t.id == pt: |
|
400 |
self._nextPageTemplateIndex = self.pageTemplates.index(t) |
|
401 |
return |
|
402 |
raise ValueError, "can't find template('%s')"%pt |
|
403 |
elif type(pt) is IntType: |
|
404 |
self._nextPageTemplateIndex = pt |
|
405 |
else: |
|
406 |
raise TypeError, "argument pt should be string or integer" |
|
407 |
||
408 |
def handle_nextFrame(self,fx): |
|
409 |
'''On endFrame chenge to the frame with name or index fx''' |
|
410 |
if type(fx) is StringType: |
|
411 |
for f in self.pageTemplate.frames: |
|
412 |
if f.id == fx: |
|
413 |
self._nextFrameIndex = self.pageTemplate.frames.index(f) |
|
414 |
return |
|
415 |
raise ValueError, "can't find frame('%s')"%fx |
|
416 |
elif type(fx) is IntType: |
|
417 |
self._nextFrameIndex = fx |
|
418 |
else: |
|
419 |
raise TypeError, "argument fx should be string or integer" |
|
420 |
||
421 |
def handle_currentFrame(self,fx): |
|
422 |
'''chenge to the frame with name or index fx''' |
|
423 |
if type(fx) is StringType: |
|
424 |
for f in self.pageTemplate.frames: |
|
425 |
if f.id == fx: |
|
426 |
self._nextFrameIndex = self.pageTemplate.frames.index(f) |
|
427 |
return |
|
428 |
raise ValueError, "can't find frame('%s')"%fx |
|
429 |
elif type(fx) is IntType: |
|
430 |
self._nextFrameIndex = fx |
|
431 |
else: |
|
432 |
raise TypeError, "argument fx should be string or integer" |
|
433 |
||
434 |
def handle_flowable(self,flowables): |
|
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
435 |
'''try to handle one flowable from the front of list flowables.''' |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
436 |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
437 |
#allow document a chance to look at, modify or ignore |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
438 |
#the object(s) about to be processed |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
439 |
self.filterFlowables(flowables) |
197 | 440 |
f = flowables[0] |
441 |
del flowables[0] |
|
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
442 |
if f is None: |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
443 |
return |
197 | 444 |
|
445 |
if isinstance(f,PageBreak): |
|
446 |
self.handle_pageBreak() |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
447 |
self.afterFlowable(f) |
197 | 448 |
elif isinstance(f,ActionFlowable): |
449 |
f.apply(self) |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
450 |
self.afterFlowable(f) |
197 | 451 |
else: |
452 |
#general case we have to do something |
|
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
453 |
if self.frame.add(f, self.canv, trySplit=self.allowSplitting): |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
454 |
self.afterFlowable(f) |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
455 |
else: |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
456 |
if self.allowSplitting: |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
457 |
# see if this is a splittable thing |
325 | 458 |
S = self.frame.split(f,self.canv) |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
459 |
n = len(S) |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
460 |
else: |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
461 |
n = 0 |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
462 |
|
197 | 463 |
if n: |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
464 |
if self.frame.add(S[0], self.canv, trySplit=0): |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
465 |
self.afterFlowable(f) |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
466 |
else: |
200 | 467 |
raise "LayoutError", "splitting error" |
468 |
del S[0] |
|
469 |
for f in xrange(n-1): |
|
197 | 470 |
flowables.insert(f,S[f]) # put split flowables back on the list |
471 |
else: |
|
249 | 472 |
if hasattr(f,'postponed'): |
473 |
raise "LayoutError", "Flowable too large" |
|
474 |
f.postponed = 1 |
|
197 | 475 |
flowables.insert(0,f) # put the flowable back |
476 |
self.handle_frameEnd() |
|
477 |
||
204 | 478 |
#these are provided so that deriving classes can refer to them |
197 | 479 |
_handle_documentBegin = handle_documentBegin |
480 |
_handle_pageBegin = handle_pageBegin |
|
481 |
_handle_pageEnd = handle_pageEnd |
|
482 |
_handle_frameBegin = handle_frameBegin |
|
483 |
_handle_frameEnd = handle_frameEnd |
|
484 |
_handle_flowable = handle_flowable |
|
485 |
_handle_nextPageTemplate = handle_nextPageTemplate |
|
486 |
_handle_currentFrame = handle_currentFrame |
|
487 |
_handle_nextFrame = handle_nextFrame |
|
488 |
||
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
489 |
def _startBuild(self, filename=None, canvasmaker=canvas.Canvas): |
253 | 490 |
self._calc() |
405 | 491 |
self.canv = canvasmaker(filename or self.filename,pagesize=self.pagesize) |
197 | 492 |
self.handle_documentBegin() |
493 |
||
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
494 |
def _endBuild(self): |
197 | 495 |
if self._hanging!=[] and self._hanging[-1] is PageBegin: |
496 |
del self._hanging[-1] |
|
497 |
self.clean_hanging() |
|
498 |
else: |
|
499 |
self.clean_hanging() |
|
500 |
self.handle_pageBreak() |
|
501 |
||
502 |
self.canv.save() |
|
339 | 503 |
#AR - hack - for some reason a document did not |
504 |
#have these: |
|
505 |
#if hasattr(self, 'frame'): del self.frame |
|
506 |
#if hasattr(self, 'pageTemplate'): del self.pageTemplate |
|
197 | 507 |
del self.frame, self.pageTemplate |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
508 |
|
272
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
509 |
def build(self, flowables, filename=None, canvasmaker=canvas.Canvas): |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
510 |
"""Build the document from a list of flowables. |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
511 |
If the filename argument is provided then that filename is used |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
512 |
rather than the one provided upon initialization. |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
513 |
If the canvasmaker argument is provided then it will be used |
305 | 514 |
instead of the default. For example a slideshow might use |
272
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
515 |
an alternate canvas which places 6 slides on a page (by |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
516 |
doing translations, scalings and redefining the page break |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
517 |
operations). |
80107aaffa7e
new build parameters to allow alternate filename and canvas implementation
aaron_watters
parents:
268
diff
changeset
|
518 |
""" |
268 | 519 |
#assert filter(lambda x: not isinstance(x,Flowable), flowables)==[], "flowables argument error" |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
520 |
self._startBuild(filename,canvasmaker) |
218
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
521 |
|
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
522 |
while len(flowables): |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
523 |
self.clean_hanging() |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
524 |
self.handle_flowable(flowables) |
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
525 |
|
274db2129c04
Fixes/Changes to get testplatypus to work with new framework
rgbecker
parents:
214
diff
changeset
|
526 |
self._endBuild() |
221 | 527 |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
528 |
#these are pure virtuals override in derived classes |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
529 |
#NB these get called at suitable places by the base class |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
530 |
#so if you derive and override the handle_xxx methods |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
531 |
#it's up to you to ensure that they maintain the needed consistency |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
532 |
def afterInit(self): |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
533 |
"""This is called after initialisation of the base class.""" |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
534 |
pass |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
535 |
|
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
536 |
def beforeDocument(self): |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
537 |
"""This is called before any processing is |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
538 |
done on the document.""" |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
539 |
pass |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
540 |
|
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
541 |
def beforePage(self): |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
542 |
"""This is called at the beginning of page |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
543 |
processing, and immediately before the |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
544 |
beforeDrawPage method of the current page |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
545 |
template.""" |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
546 |
pass |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
547 |
|
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
548 |
def afterPage(self): |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
549 |
"""This is called after page processing, and |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
550 |
immediately after the afterDrawPage method |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
551 |
of the current page template.""" |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
552 |
pass |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
553 |
|
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
554 |
def filterFlowables(self,flowables): |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
555 |
'''called to filter flowables at the start of the main handle_flowable method. |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
556 |
Upon return if flowables[0] has been set to None it is discarded and the main |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
557 |
method returns. |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
558 |
''' |
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
559 |
pass |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
560 |
|
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
561 |
def afterFlowable(self, flowable): |
295
1f00bd112cb0
remove UserDocTemplate, but add Andy's hook methods
rgbecker
parents:
294
diff
changeset
|
562 |
'''called after a flowable has been rendered''' |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
563 |
pass |
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
564 |
|
221 | 565 |
class SimpleDocTemplate(BaseDocTemplate): |
268 | 566 |
"""A special case document template that will handle many simple documents. |
567 |
See documentation for BaseDocTemplate. No pageTemplates are required |
|
305 | 568 |
for this special case. A page templates are inferred from the |
268 | 569 |
margin information and the onFirstPage, onLaterPages arguments to the build method. |
570 |
||
571 |
A document which has all pages with the same look except for the first |
|
572 |
page may can be built using this special approach. |
|
305 | 573 |
""" |
322 | 574 |
_invalidInitArgs = ('pageTemplates',) |
221 | 575 |
def handle_pageBegin(self): |
316 | 576 |
'''override base method to add a change of page template after the firstpage. |
577 |
''' |
|
221 | 578 |
self._handle_pageBegin() |
579 |
self._handle_nextPageTemplate('Later') |
|
580 |
||
581 |
def build(self,flowables,onFirstPage=_doNothing, onLaterPages=_doNothing): |
|
305 | 582 |
"""build the document using the flowables. Annotate the first page using the onFirstPage |
583 |
function and later pages using the onLaterPages function. The onXXX pages should follow |
|
584 |
the signature |
|
585 |
||
586 |
def myOnFirstPage(canvas, document): |
|
587 |
# do annotations and modify the document |
|
588 |
... |
|
589 |
||
316 | 590 |
The functions can do things like draw logos, page numbers, |
305 | 591 |
footers, etcetera. They can use external variables to vary |
592 |
the look (for example providing page numbering or section names). |
|
593 |
""" |
|
322 | 594 |
self._calc() #in case we changed margins sizes etc |
227 | 595 |
frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, id='normal') |
221 | 596 |
self.addPageTemplates([PageTemplate(id='First',frames=frameT, onPage=onFirstPage), |
597 |
PageTemplate(id='Later',frames=frameT, onPage=onLaterPages)]) |
|
225 | 598 |
if onFirstPage is _doNothing and hasattr(self,'onFirstPage'): |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
599 |
self.pageTemplates[0].beforeDrawPage = self.onFirstPage |
225 | 600 |
if onLaterPages is _doNothing and hasattr(self,'onLaterPages'): |
284
eabeb5f4e851
Added UserDocTemplate class, and paragraph.getPlainText()
andy_robinson
parents:
279
diff
changeset
|
601 |
self.pageTemplates[1].beforeDrawPage = self.onLaterPages |
221 | 602 |
BaseDocTemplate.build(self,flowables) |
603 |
||
604 |
if __name__ == '__main__': |
|
605 |
########################################################## |
|
606 |
## |
|
607 |
## testing |
|
608 |
## |
|
609 |
########################################################## |
|
610 |
def randomText(): |
|
611 |
#this may or may not be appropriate in your company |
|
612 |
from random import randint, choice |
|
613 |
||
614 |
RANDOMWORDS = ['strategic','direction','proactive', |
|
615 |
'reengineering','forecast','resources', |
|
616 |
'forward-thinking','profit','growth','doubletalk', |
|
617 |
'venture capital','IPO'] |
|
618 |
||
619 |
sentences = 5 |
|
620 |
output = "" |
|
621 |
for sentenceno in range(randint(1,5)): |
|
622 |
output = output + 'Blah' |
|
623 |
for wordno in range(randint(10,25)): |
|
624 |
if randint(0,4)==0: |
|
625 |
word = choice(RANDOMWORDS) |
|
626 |
else: |
|
627 |
word = 'blah' |
|
628 |
output = output + ' ' +word |
|
629 |
output = output+'.' |
|
630 |
return output |
|
631 |
||
632 |
def myFirstPage(canvas, doc): |
|
633 |
canvas.saveState() |
|
634 |
canvas.setStrokeColor(red) |
|
635 |
canvas.setLineWidth(5) |
|
636 |
canvas.line(66,72,66,PAGE_HEIGHT-72) |
|
637 |
canvas.setFont('Times-Bold',24) |
|
638 |
canvas.drawString(108, PAGE_HEIGHT-108, "PLATYPUS") |
|
639 |
canvas.setFont('Times-Roman',12) |
|
640 |
canvas.drawString(4 * inch, 0.75 * inch, "First Page") |
|
641 |
canvas.restoreState() |
|
642 |
||
643 |
def myLaterPages(canvas, doc): |
|
644 |
canvas.saveState() |
|
645 |
canvas.setStrokeColor(red) |
|
646 |
canvas.setLineWidth(5) |
|
647 |
canvas.line(66,72,66,PAGE_HEIGHT-72) |
|
648 |
canvas.setFont('Times-Roman',12) |
|
649 |
canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) |
|
650 |
canvas.restoreState() |
|
651 |
||
652 |
def run(): |
|
653 |
objects_to_draw = [] |
|
654 |
from reportlab.lib.styles import ParagraphStyle |
|
253 | 655 |
#from paragraph import Paragraph |
225 | 656 |
from doctemplate import SimpleDocTemplate |
221 | 657 |
|
658 |
#need a style |
|
659 |
normal = ParagraphStyle('normal') |
|
660 |
normal.firstLineIndent = 18 |
|
661 |
normal.spaceBefore = 6 |
|
662 |
import random |
|
663 |
for i in range(15): |
|
664 |
height = 0.5 + (2*random.random()) |
|
665 |
box = XBox(6 * inch, height * inch, 'Box Number %d' % i) |
|
666 |
objects_to_draw.append(box) |
|
667 |
para = Paragraph(randomText(), normal) |
|
668 |
objects_to_draw.append(para) |
|
669 |
||
253 | 670 |
SimpleDocTemplate('doctemplate.pdf').build(objects_to_draw, |
221 | 671 |
onFirstPage=myFirstPage,onLaterPages=myLaterPages) |
672 |
||
673 |
run() |
|
294 | 674 |