reportlab/platypus/doctemplate.py
changeset 2488 8bc9673fffa6
parent 2466 0edb3b4ab6ff
child 2491 69140e8a8285
equal deleted inserted replaced
2487:a51bf871b709 2488:8bc9673fffa6
   409             if self._onProgress:
   409             if self._onProgress:
   410                 self._onProgress('PAGE', self.canv.getPageNumber())
   410                 self._onProgress('PAGE', self.canv.getPageNumber())
   411             self.pageTemplate.afterDrawPage(self.canv, self)
   411             self.pageTemplate.afterDrawPage(self.canv, self)
   412             self.pageTemplate.onPageEnd(self.canv, self)
   412             self.pageTemplate.onPageEnd(self.canv, self)
   413             self.afterPage()
   413             self.afterPage()
       
   414             self.canv.setPageRotation(getattr(self.pageTemplate,'rotation',0)
   414             self.canv.showPage()
   415             self.canv.showPage()
   415 
   416 
   416             if hasattr(self,'_nextPageTemplateCycle'):
   417             if hasattr(self,'_nextPageTemplateCycle'):
   417                 #they are cycling through pages'; we keep the index
   418                 #they are cycling through pages'; we keep the index
   418                 cyc = self._nextPageTemplateCycle
   419                 cyc = self._nextPageTemplateCycle
   824         '''override base method to add a change of page template after the firstpage.
   825         '''override base method to add a change of page template after the firstpage.
   825         '''
   826         '''
   826         self._handle_pageBegin()
   827         self._handle_pageBegin()
   827         self._handle_nextPageTemplate('Later')
   828         self._handle_nextPageTemplate('Later')
   828 
   829 
   829     def build(self,flowables,onFirstPage=_doNothing, onLaterPages=_doNothing):
   830     def build(self,flowables,onFirstPage=_doNothing, onLaterPages=_doNothing, canvasmaker=canvas.Canvas):
   830         """build the document using the flowables.  Annotate the first page using the onFirstPage
   831         """build the document using the flowables.  Annotate the first page using the onFirstPage
   831                function and later pages using the onLaterPages function.  The onXXX pages should follow
   832                function and later pages using the onLaterPages function.  The onXXX pages should follow
   832                the signature
   833                the signature
   833 
   834 
   834                   def myOnFirstPage(canvas, document):
   835                   def myOnFirstPage(canvas, document):
   845                         PageTemplate(id='Later',frames=frameT, onPage=onLaterPages,pagesize=self.pagesize)])
   846                         PageTemplate(id='Later',frames=frameT, onPage=onLaterPages,pagesize=self.pagesize)])
   846         if onFirstPage is _doNothing and hasattr(self,'onFirstPage'):
   847         if onFirstPage is _doNothing and hasattr(self,'onFirstPage'):
   847             self.pageTemplates[0].beforeDrawPage = self.onFirstPage
   848             self.pageTemplates[0].beforeDrawPage = self.onFirstPage
   848         if onLaterPages is _doNothing and hasattr(self,'onLaterPages'):
   849         if onLaterPages is _doNothing and hasattr(self,'onLaterPages'):
   849             self.pageTemplates[1].beforeDrawPage = self.onLaterPages
   850             self.pageTemplates[1].beforeDrawPage = self.onLaterPages
   850         BaseDocTemplate.build(self,flowables)
   851         BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
   851 
   852 
   852 
   853 
   853 def progressCB(typ, value):
   854 def progressCB(typ, value):
   854     """Example prototype for progress monitoring.
   855     """Example prototype for progress monitoring.
   855 
   856