Python reportlab.platypus 模块,PageBreak() 实例源码

我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用reportlab.platypus.PageBreak()

项目:geo-hpc    作者:itpir    | 项目源码 | 文件源码
def add_notes(self):

        with open(self.assets_dir + '/templates/field_names.txt') as field_names:
            for line in field_names:
                p = Paragraph(line, self.styles['BodyText'])
                self.Story.append(p)

        self.Story.append(PageBreak())

        with open(self.assets_dir + '/templates/notes.txt') as field_names:
            for line in field_names:
                p = Paragraph(line, self.styles['BodyText'])
                self.Story.append(p)

        self.Story.append(PageBreak())

        with open(self.assets_dir + '/templates/aid_data.txt') as field_names:
            for line in field_names:
                p = Paragraph(line, self.styles['BodyText'])
                self.Story.append(p)
项目:ZLib    作者:zenist    | 项目源码 | 文件源码
def __init__(self, file_path):
        self.__register_font()
        self.__doc = myDocTemplate(file_path)
        self.__title = "JY.zenist.song PDF??"
        self.__page_info = "JY.zenist.song"
        self.__content = [PageBreak()]
项目:ZLib    作者:zenist    | 项目源码 | 文件源码
def add_page_break(self):
        '''?????'''
        self.__content.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):

        self.Score_Table=Table(self.Score_Data,[self.cW1*cm]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])          
        #self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])
        self.Attendance_Table=Table(self.Attendance_Data,[self.cW1*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 15))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):
        #self.Score_Table=Table(self.Score_Data,[.3*inch]+[1*inch]+8*[0.6*inch], [.8*inch]+[.6*inch]+14*[0.35*inch])   

        self.Score_Table=Table(self.Score_Data,[.5*inch]+[(self.cW1*cm)-.5*inch]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])   

        self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 18))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):

        self.Score_Table=Table(self.Score_Data,[self.cW1*cm]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])          
        #self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])
        self.Attendance_Table=Table(self.Attendance_Data,[self.cW1*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 15))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):
        #self.Score_Table=Table(self.Score_Data,[.3*inch]+[1*inch]+8*[0.6*inch], [.8*inch]+[.6*inch]+14*[0.35*inch])   

        self.Score_Table=Table(self.Score_Data,[.5*inch]+[(self.cW1*cm)-.5*inch]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])   

        self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 18))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):
        #self.Score_Table=Table(self.Score_Data,[.3*inch]+[1*inch]+8*[0.6*inch], [.8*inch]+[.6*inch]+14*[0.35*inch])   

        self.Score_Table=Table(self.Score_Data,[.5*inch]+[(self.cW1*cm)-.5*inch]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])   

        self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 18))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):
        self.Score_Table=Table(self.Score_Data,[self.cW1*cm]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])          
        self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 15))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):
        #self.Score_Table=Table(self.Score_Data,[.3*inch]+[1*inch]+8*[0.6*inch], [.8*inch]+[.6*inch]+14*[0.35*inch])   

        self.Score_Table=Table(self.Score_Data,[.3*inch]+[(self.cW1*cm)-.3*inch]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])   

        self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        self.elements.append(self.Score_Table)
        self.elements.append(Spacer(1, 15))
        self.elements.append(self.Attendance_Table)
        self.elements.append(PageBreak())
项目:geo-hpc    作者:itpir    | 项目源码 | 文件源码
def build_doc(self):

        rid = self.request_id
        print 'build_doc: ' + rid

        # try:

        self.doc = SimpleDocTemplate(self.output, pagesize=letter)

        # build doc call all functions

        self.add_header()
        self.Story.append(Spacer(1, 0.5*inch))
        self.add_info()
        self.Story.append(Spacer(1, 0.3*inch))
        self.add_timeline()
        self.Story.append(Spacer(1, 0.3*inch))
        self.add_cite_and_contents()
        self.Story.append(PageBreak())

        self.add_meta()
        self.Story.append(PageBreak())

        self.add_notes()
        self.Story.append(PageBreak())

        self.add_additional()

        self.output_doc()

        return True
        # except:
        #     return False


    # documentation header
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def AddPage(self):

        #self.Score_Table=Table(self.Score_Data,[self.cW1*cm]+8*[self.cW*cm], [self.rH1*cm]+[self.rH2*cm]+14*[self.rH*cm])          
        #self.Attendance_Table=Table(self.Attendance_Data,[self.cW*2.2*cm]+4*[self.cW*2*cm],5*[self.rH*cm])

        #self.Score_Table.setStyle(TableStyle(self.Score_T_Style))
        #self.Attendance_Table.setStyle(TableStyle(self.Attendance_T_Style))

        """self.Format_Title()
        self.Set_Consolidation()
        self.Set_Consolidation_Style()
        """


        self.Each_Pupil_Table=Table(self.Each_Pupil,[self.cW1*cm]*2+[self.cW2*cm]+[1*cm]*2+[self.cW3*cm]*41+[ self.cW4*cm]*11+[self.cW5*cm]+[self.cW3*cm]*3,[self.rH1*cm]*4)
        self.Each_Pupil_Table.setStyle(TableStyle(self.Each_Pupil_Style))




        self.table_count+=1



        if self.page_count==0: # the fist page


            self.elements.append(self.TITLE1)
            self.elements.append(Spacer(1, 20))
            self.elements.append(self.TITLE2)              
            self.elements.append(Spacer(1, 15))
            self.elements.append(self.Heading_Table)

        """if self.table_count==1:# Beginning of the page

            self.Heading_Table=Table(self.HEADING,[self.cW1*cm]*2+[self.cW2*cm]+[1*cm]*2+[self.cW3*cm]*56,[self.rH2*cm]+[self.rH3*cm]+[self.rH4*cm])
            self.Heading_Table.setStyle(TableStyle(self.Heading_Style))            
            self.elements.append(self.Heading_Table)
        """    
        if self.page_count==0 and self.table_count==16:

            self.elements.append(PageBreak())
            #self.Heading_Table=Table(self.HEADING,[self.cW1*cm]*2+[self.cW2*cm]+[1*cm]*2+[self.cW3*cm]*56,[self.rH2*cm]+[self.rH3*cm]+[self.rH4*cm])
            #self.Heading_Table.setStyle(TableStyle(self.Heading_Style))            
            self.elements.append(self.Heading_Table)
            self.elements.append(self.Each_Pupil_Table)
            self.table_count=0

        elif self.table_count==17:
            self.elements.append(PageBreak())
            #self.Heading_Table=Table(self.HEADING,[self.cW1*cm]*2+[self.cW2*cm]+[1*cm]*2+[self.cW3*cm]*56,[self.rH2*cm]+[self.rH3*cm]+[self.rH4*cm])
            #self.Heading_Table.setStyle(TableStyle(self.Heading_Style))            
            self.elements.append(self.Heading_Table)
            self.elements.append(self.Each_Pupil_Table)
            self.table_count=0
        else:

            self.elements.append(self.Each_Pupil_Table)


        self.page_count+=1
项目:mes    作者:osess    | 项目源码 | 文件源码
def _flowable(self, node):
        if node.localName=='para':
            style = self.styles.para_style_get(node)
            return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
        elif node.localName=='name':
            self.styles.names[ node.getAttribute('id')] = node.getAttribute('value')
            return None
        elif node.localName=='xpre':
            style = self.styles.para_style_get(node)
            return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'})))
        elif node.localName=='pre':
            style = self.styles.para_style_get(node)
            return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'})))
        elif node.localName=='illustration':
            return  self._illustration(node)
        elif node.localName=='blockTable':
            return  self._table(node)
        elif node.localName=='title':
            styles = reportlab.lib.styles.getSampleStyleSheet()
            style = styles['Title']
            return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
        elif node.localName=='h1':
            styles = reportlab.lib.styles.getSampleStyleSheet()
            style = styles['Heading1']
            return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
        elif node.localName=='h2':
            styles = reportlab.lib.styles.getSampleStyleSheet()
            style = styles['Heading2']
            return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
        elif node.localName=='h3':
            styles = reportlab.lib.styles.getSampleStyleSheet()
            style = styles['Heading3']
            return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'})))
        elif node.localName=='image':
            return platypus.Image(node.getAttribute('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
        elif node.localName=='spacer':
            if node.hasAttribute('width'):
                width = utils.unit_get(node.getAttribute('width'))
            else:
                width = utils.unit_get('1cm')
            length = utils.unit_get(node.getAttribute('length'))
            return platypus.Spacer(width=width, height=length)
        elif node.localName=='pageBreak':
            return platypus.PageBreak()
        elif node.localName=='condPageBreak':
            return platypus.CondPageBreak(**(utils.attr_get(node, ['height'])))
        elif node.localName=='setNextTemplate':
            return platypus.NextPageTemplate(str(node.getAttribute('name')))
        elif node.localName=='nextFrame':
            return platypus.CondPageBreak(1000)           # TODO: change the 1000 !
        else:
            sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.localName,))
            return None