src/reportlab/platypus/doctemplate.py
changeset 3368 afa025c34493
parent 3326 ce725978d11c
child 3374 348f9bcb4c11
equal deleted inserted replaced
3367:bce0159f2980 3368:afa025c34493
  1142     want to take that performance hit.
  1142     want to take that performance hit.
  1143     """
  1143     """
  1144     print 'PROGRESS MONITOR:  %-10s   %d' % (typ, value)
  1144     print 'PROGRESS MONITOR:  %-10s   %d' % (typ, value)
  1145 
  1145 
  1146 if __name__ == '__main__':
  1146 if __name__ == '__main__':
  1147 
  1147     from reportlab.lib.styles import _baseFontName, _baseFontNameB
  1148     def myFirstPage(canvas, doc):
  1148     def myFirstPage(canvas, doc):
  1149         from reportlab.lib.colors import red
  1149         from reportlab.lib.colors import red
  1150         PAGE_HEIGHT = canvas._pagesize[1]
  1150         PAGE_HEIGHT = canvas._pagesize[1]
  1151         canvas.saveState()
  1151         canvas.saveState()
  1152         canvas.setStrokeColor(red)
  1152         canvas.setStrokeColor(red)
  1153         canvas.setLineWidth(5)
  1153         canvas.setLineWidth(5)
  1154         canvas.line(66,72,66,PAGE_HEIGHT-72)
  1154         canvas.line(66,72,66,PAGE_HEIGHT-72)
  1155         canvas.setFont('Times-Bold',24)
  1155         canvas.setFont(_baseFontNameB,24)
  1156         canvas.drawString(108, PAGE_HEIGHT-108, "TABLE OF CONTENTS DEMO")
  1156         canvas.drawString(108, PAGE_HEIGHT-108, "TABLE OF CONTENTS DEMO")
  1157         canvas.setFont('Times-Roman',12)
  1157         canvas.setFont(_baseFontName,12)
  1158         canvas.drawString(4 * inch, 0.75 * inch, "First Page")
  1158         canvas.drawString(4 * inch, 0.75 * inch, "First Page")
  1159         canvas.restoreState()
  1159         canvas.restoreState()
  1160 
  1160 
  1161     def myLaterPages(canvas, doc):
  1161     def myLaterPages(canvas, doc):
  1162         from reportlab.lib.colors import red
  1162         from reportlab.lib.colors import red
  1163         PAGE_HEIGHT = canvas._pagesize[1]
  1163         PAGE_HEIGHT = canvas._pagesize[1]
  1164         canvas.saveState()
  1164         canvas.saveState()
  1165         canvas.setStrokeColor(red)
  1165         canvas.setStrokeColor(red)
  1166         canvas.setLineWidth(5)
  1166         canvas.setLineWidth(5)
  1167         canvas.line(66,72,66,PAGE_HEIGHT-72)
  1167         canvas.line(66,72,66,PAGE_HEIGHT-72)
  1168         canvas.setFont('Times-Roman',12)
  1168         canvas.setFont(_baseFontName,12)
  1169         canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page)
  1169         canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page)
  1170         canvas.restoreState()
  1170         canvas.restoreState()
  1171 
  1171 
  1172     def run():
  1172     def run():
  1173         objects_to_draw = []
  1173         objects_to_draw = []