def __init__(self, filename, **kw):
     m = 2 * cm
     from reportlab.lib import pagesizes
     PAGESIZE = pagesizes.landscape(pagesizes.A4)
     cw, ch = (PAGESIZE[0] - 2 * m) / 2., (PAGESIZE[1] - 2 * m)
     ch -= 14 * cm
     f1 = Frame(m,
                m + 0.5 * cm,
                cw - 0.75 * cm,
                ch - 1 * cm,
                id='F1',
                leftPadding=0,
                topPadding=0,
                rightPadding=0,
                bottomPadding=0,
                showBoundary=True)
     f2 = Frame(cw + 2.7 * cm,
                m + 0.5 * cm,
                cw - 0.75 * cm,
                ch - 1 * cm,
                id='F2',
                leftPadding=0,
                topPadding=0,
                rightPadding=0,
                bottomPadding=0,
                showBoundary=True)
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('template', [f1, f2])
     self.addPageTemplates(template)
示例#2
0
    def __init__(self, filename, context, **kw):
        BaseDocTemplate.__init__(self, filename, **kw)
        self.toc_index = 0
        body_attrs = (self.leftMargin, self.bottomMargin, self.width,
                      self.height)
        self.main_frame_attr = {'x1': self.leftMargin,
                                'y1': self.bottomMargin,
                                'width': self.width,
                                'height': self.height,
                                'id':'normal',
                                'showBoundary': self.showBoundary}

        # We keep the main frame reference to resize it during the build
        self.main_frame = Frame(**self.main_frame_attr)
        self.main_frame_change = False
        template_attrs = {'id': 'now', 'frames': [self.main_frame],
                          'pagesize': kw['pagesize']}
        page_template = PageTemplate(**template_attrs)
        self.platypus_header_calculate = False
        self.platypus_header_height = None
        self.platypus_footer = None
        self.context = context
        self.addPageTemplates([page_template])
        self.toc_high_level = self.context.toc_high_level

        self.frame_attr = {'leftPadding': 0, 'bottomPadding': 6,
                           'rightPadding': 0, 'topPadding': 6,
                           'showBoundary': 0}
        self.context = context
        # calculate width available
        self.width_available = self.width
        self.width_available -= self.frame_attr['leftPadding']
        self.width_available -= self.frame_attr['rightPadding']
示例#3
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     kw["showBoundary"] = 1
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(
         [
             PageTemplate(
                 "normal",
                 [
                     Frame(
                         inch,
                         inch,
                         6.27 * inch,
                         9.69 * inch,
                         id="first",
                         topPadding=0,
                         rightPadding=0,
                         leftPadding=0,
                         bottomPadding=0,
                         showBoundary=ShowBoundaryValue(color="red"),
                     )
                 ],
             )
         ]
     )
示例#4
0
    def __init__(self, filename, plugin_dir, growing_year, cur_date, **kw):
        """Generate a basic A4 pdf document

        Parameters
        ----------
        filename: str
            The file name to store the PDF document
        tr: translation
            The Translation function from GeoDataFarm
        plugin_dir: str
            path to the plugin dir in order to find the icon
        growing_year: int
             What growing year
        cur_date: str
            Current date, to write on the report
        kw
        """
        BaseDocTemplate.__init__(self, filename, **kw)
        self.allowSplitting = 1
        translate = TR('MyDocTemplate')
        self.tr = translate.tr
        self.plugin_dir = plugin_dir
        frame = Frame(self.leftMargin,
                      self.bottomMargin,
                      self.width,
                      self.height - 2 * cm,
                      id='normal')
        template = PageTemplate(id='test',
                                frames=frame,
                                onPage=partial(self.header,
                                               growing_year=growing_year,
                                               cur_date=cur_date))
        self.addPageTemplates(template)
示例#5
0
    def __init__(self, filename, **kw):
        m = 2 * cm
        from reportlab.lib import pagesizes

        PAGESIZE = pagesizes.landscape(pagesizes.A4)
        cw, ch = (PAGESIZE[0] - 2 * m) / 2.0, (PAGESIZE[1] - 2 * m)
        ch -= 14 * cm
        f1 = Frame(
            m,
            m + 0.5 * cm,
            cw - 0.75 * cm,
            ch - 1 * cm,
            id="F1",
            leftPadding=0,
            topPadding=0,
            rightPadding=0,
            bottomPadding=0,
            showBoundary=True,
        )
        f2 = Frame(
            cw + 2.7 * cm,
            m + 0.5 * cm,
            cw - 0.75 * cm,
            ch - 1 * cm,
            id="F2",
            leftPadding=0,
            topPadding=0,
            rightPadding=0,
            bottomPadding=0,
            showBoundary=True,
        )
        BaseDocTemplate.__init__(self, filename, **kw)
        template = PageTemplate("template", [f1, f2])
        self.addPageTemplates(template)
示例#6
0
    def __init__(self, filename, context, **kw):
        BaseDocTemplate.__init__(self, filename, **kw)
        self.toc_index = 0
        self.main_frame_attr = {'x1': self.leftMargin,
                                'y1': self.bottomMargin,
                                'width': self.width,
                                'height': self.height,
                                'id':'normal',
                                'showBoundary': self.showBoundary}

        # We keep the main frame reference to resize it during the build
        self.main_frame = Frame(**self.main_frame_attr)
        self.main_frame_change = False
        template_attrs = {'id': 'now', 'frames': [self.main_frame],
                          'pagesize': kw['pagesize']}
        page_template = PageTemplate(**template_attrs)
        self.platypus_header_calculate = False
        self.platypus_header_height = None
        self.platypus_footer = None
        self.context = context
        self.addPageTemplates([page_template])
        self.toc_high_level = self.context.toc_high_level

        self.frame_attr = {'leftPadding': 0, 'bottomPadding': 6,
                           'rightPadding': 0, 'topPadding': 6,
                           'showBoundary': 0}
        self.context = context
        # calculate width available
        self.width_available = self.width
        self.width_available -= self.frame_attr['leftPadding']
        self.width_available -= self.frame_attr['rightPadding']
示例#7
0
    def __init__(self, filename, **kw):

        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)

        self.pagesize = A4
        self.topMargin = 0.5 * cm
        self.bottomMargin = 2 * cm
        self.leftMargin = 1 * cm
        self.rightMargin = 1 * cm
        self._calc()

        frameT = Frame(self.leftMargin,
                       self.bottomMargin,
                       self.width,
                       self.height,
                       id='normal',
                       showBoundary=0)
        # Table of contents padding
        tocP = 3 * cm
        frameTOC = Frame(self.leftMargin,
                         self.bottomMargin,
                         self.width,
                         self.height,
                         leftPadding=tocP,
                         rightPadding=tocP,
                         id='toc',
                         showBoundary=0)

        titleTemplate = PageTemplate('title', frames=frameT, onPage=titlePage)
        tocTemplate = PageTemplate('toc', frames=frameTOC, onPage=tocPage)
        template = PageTemplate('normal', frames=frameT, onPage=defaultPage)

        self.addPageTemplates([titleTemplate, tocTemplate, template])
示例#8
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate(
         "normal", [Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id="F1")]
     )
     self.addPageTemplates(template)
示例#9
0
    def __init__(self, filename, **kw):
        self.allowSplitting = 0

        self.pagesize = kw.get('pagesize', landscape(A5))
        kw['pagesize'] = self.pagesize

        BaseDocTemplate.__init__(self, filename, **kw)

        w, h = self.pagesize

        # self.actualWidth, self.actualHeight = landscape(A5)
        self.topMargin = 2.85 * cm
        self.leftMargin = 0.15 * cm
        self.bottomMargin = 0.15 * cm

        fh = h - self.topMargin - self.bottomMargin
        fw = w - (2 * self.leftMargin)

        frame = Frame(self.leftMargin,
                      self.bottomMargin,
                      fw,
                      fh,
                      id='ContentFrame',
                      showBoundary=False)

        template = PageTemplate('normal',
                                frames=[
                                    frame,
                                ],
                                pagesize=self.pagesize)
        self.loadFonts()
        self.addPageTemplates(template)
示例#10
0
文件: reports.py 项目: HCCB/janus
    def __init__(self, filename, **kw):
        self.allowSplitting = 0

        self.pagesize = kw.get('pagesize', landscape(A5))
        kw['pagesize'] = self.pagesize

        BaseDocTemplate.__init__(self, filename, **kw)

        w, h = self.pagesize

        # self.actualWidth, self.actualHeight = landscape(A5)
        self.topMargin = 2.85 * cm
        self.leftMargin = 0.15 * cm
        self.bottomMargin = 0.15 * cm

        fh = h - self.topMargin - self.bottomMargin
        fw = w - (2 * self.leftMargin)

        frame = Frame(self.leftMargin, self.bottomMargin,
                      fw, fh,
                      id='ContentFrame',
                      showBoundary=False)

        template = PageTemplate('normal', frames=[frame, ],
                                pagesize=self.pagesize)
        self.loadFonts()
        self.addPageTemplates(template)
示例#11
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')])
     self.addPageTemplates(template)
     def afterFlowable(self, flowable):
         "Registers TOC entries."
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
     frame2 = Frame(2.5*cm, 2.5*cm, 310, 25*cm, id='F2')
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [frame1], myMainPageFrame)
     template1 = PageTemplate('special', [frame2], myMainPageFrame)
     self.addPageTemplates([template,template1])
示例#13
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.page_width, self.page_height = self.pagesize
     first_page_tpl = PageTemplate(
         'normal', [Frame(0, 0, 21 * cm, 29.7 * cm, id='F1')],
         onPage=self._draw_static_elements)
     self.addPageTemplates(first_page_tpl)
示例#14
0
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1')
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('nomal', [frame1], onPageEnd=HeaderFooter)
     #template = PageTemplate('nomal', [Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1')], onPageEnd=HeaderFooter)
     #template = PageTemplate('nomal', [Frame(2.5*cm, 2.5*cm, 16*cm, 25*cm, id='F1', showBoundary=1)], onPageEnd=HeaderFooter)
     self.addPageTemplates(template)
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
     frame2 = Frame(2.5*cm, 2.5*cm, 310, 25*cm, id='F2')
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [frame1], myMainPageFrame)
     template1 = PageTemplate('special', [frame2], myMainPageFrame)
     self.addPageTemplates([template,template1])
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(
             [
             PageTemplate('normal',
                     [Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))],
                     ),
             ])
示例#17
0
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id="F1")
     frame2 = Frame(2.5 * cm, 2.5 * cm, 310, 25 * cm, id="F2")
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate("normal", [frame1], myMainPageFrame)
     template1 = PageTemplate("special", [frame2], myMainPageFrame)
     template2 = PageTemplate("template2", [Frame(395, 108, 165, 645, id="second2")])
     self.addPageTemplates([template, template1, template2])
示例#18
0
 def __init__(self, filename, **kw):
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates([
         PageTemplate(
             id='plain',
             frames=[Frame(2.5 * cm, 2.5 * cm, 16 * cm, 25 * cm, id='F1')]),
         LeftPageTemplate(),
         RightPageTemplate()
     ])
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(
             [
             PageTemplate('normal',
                     [Frame(inch, inch, 6.27*inch, 9.69*inch, id='first',topPadding=0,rightPadding=0,leftPadding=0,bottomPadding=0,showBoundary=ShowBoundaryValue(color="red"))],
                     ),
             ])
 def __init__(self, filename, **kw):
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(
         [
             PageTemplate(id="plain", frames=[Frame(2.5 * cm, 2.5 * cm, 16 * cm, 25 * cm, id="F1")]),
             LeftPageTemplate(),
             RightPageTemplate(),
         ]
     )
示例#21
0
文件: pdf.py 项目: nyuhuhuu/trachacks
    def __init__(self, filename, pagesize, stickysize, show_boundary=False):
        self.cols = int(pagesize[0] // stickysize[0])
        self.rows = int(pagesize[1] // stickysize[1])

        templates = [
            StickyPage('sticky-page', pagesize, stickysize, self.cols,
                       self.rows, show_boundary),
        ]
        BaseDocTemplate.__init__(self, filename, pageTemplates=templates,
                                 allowSplitting=0, creator=self._get_creator())
示例#22
0
 def __init__(self, output, status_callback=None, tocCallback=None, **kwargs):
     self.bookmarks = []
     BaseDocTemplate.__init__(self, output, **kwargs)
     if status_callback:
         self.estimatedDuration = 0
         self.progress = 0
         self.setProgressCallBack(self.progressCB)
         self.status_callback = status_callback
     self.tocCallback = tocCallback
     self.title = kwargs["title"]
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 15.5*cm, 6*cm, 10*cm, id='F1')
     frame2 = Frame(11.5*cm, 15.5*cm, 6*cm, 10*cm, id='F2')
     frame3 = Frame(2.5*cm, 2.5*cm, 6*cm, 10*cm, id='F3')
     frame4 = Frame(11.5*cm, 2.5*cm, 6*cm, 10*cm, id='F4')
     self.allowSplitting = 0
     self.showBoundary = 1
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [frame1, frame2, frame3, frame4], myMainPageFrame)
     self.addPageTemplates(template)
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id="F1")
     frame2 = Frame(11.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id="F2")
     frame3 = Frame(2.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id="F3")
     frame4 = Frame(11.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id="F4")
     self.allowSplitting = 0
     self.showBoundary = 1
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate("normal", [frame1, frame2, frame3, frame4], myMainPageFrame)
     self.addPageTemplates(template)
    def __init__(self, filename, **kw):
        frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template1 = PageTemplate('normal', [frame1], myMainPageFrame)

        frame2 = Frame(2.5*cm, 16*cm, 15*cm, 10*cm, id='F2', showBoundary=1)
        frame3 = Frame(2.5*cm, 2.5*cm, 15*cm, 10*cm, id='F3', showBoundary=1)

        template2 = PageTemplate('updown', [frame2, frame3])
        self.addPageTemplates([template1, template2])
    def __init__(self, filename, **kw):
        frame1 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id="F1")
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template1 = PageTemplate("normal", [frame1], myMainPageFrame)

        frame2 = Frame(2.5 * cm, 16 * cm, 15 * cm, 10 * cm, id="F2", showBoundary=1)
        frame3 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 10 * cm, id="F3", showBoundary=1)

        template2 = PageTemplate("updown", [frame2, frame3])
        self.addPageTemplates([template1, template2])
    def __init__(self, filename, **kw):
        frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template1 = PageTemplate('normal', [frame1], myMainPageFrame)

        frame2 = Frame(2.5*cm, 16*cm, 15*cm, 10*cm, id='F2', showBoundary=1)
        frame3 = Frame(2.5*cm, 2.5*cm, 15*cm, 10*cm, id='F3', showBoundary=1)

        template2 = PageTemplate('updown', [frame2, frame3])
        self.addPageTemplates([template1, template2])
示例#28
0
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id='F1')
     frame2 = Frame(11.5 * cm, 15.5 * cm, 6 * cm, 10 * cm, id='F2')
     frame3 = Frame(2.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id='F3')
     frame4 = Frame(11.5 * cm, 2.5 * cm, 6 * cm, 10 * cm, id='F4')
     self.allowSplitting = 0
     self.showBoundary = 1
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [frame1, frame2, frame3, frame4],
                             myMainPageFrame)
     self.addPageTemplates(template)
示例#29
0
    def __init__(self, *args, **kwargs):
        BaseDocTemplate.__init__(self, *args, **kwargs)
        self.bottomTableHeight = 0
        self.bottomTableIsLast = False
        self.numPages = 0
        self._lastNumPages = 0
        self.setProgressCallBack(self._onProgress_cb)

        # For batch reports with several PDFs concatenated
        self.restartDoc = False
        self.restartDocIndex = 0
        self.restartDocPageNumbers = []
示例#30
0
    def __init__(self, filename, **kw):
        frame1 = Frame(inch, inch, A4[0] - 2 * inch, A4[1] - 2 * inch, id='F1')
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template = PageTemplate('normal', [frame1], myMainPageFrame)
        self.addPageTemplates(template)

        top_margin = A4[1] - inch
        bottom_margin = inch
        left_margin = inch
        right_margin = A4[0] - inch
        frame_width = right_margin - left_margin
示例#31
0
    def __init__(self, *args, **kwargs):
        BaseDocTemplate.__init__(self, *args, **kwargs)
        self.bottomTableHeight = 0
        self.bottomTableIsLast = False
        self.numPages = 0
        self._lastNumPages = 0
        self.setProgressCallBack(self._onProgress_cb)

        # For batch reports with several PDFs concatenated
        self.restartDoc = False
        self.restartDocIndex = 0
        self.restartDocPageNumbers = []
示例#32
0
 def __init__(self,
              output,
              status_callback=None,
              tocCallback=None,
              **kwargs):
     self.bookmarks = []
     BaseDocTemplate.__init__(self, output, **kwargs)
     if status_callback:
         self.estimatedDuration = 0
         self.progress = 0
         self.setProgressCallBack(self.progressCB)
         self.status_callback = status_callback
     self.tocCallback = tocCallback
     self.title = kwargs['title']
示例#33
0
 def __init__(self, filename, **kw):
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [
         Frame(0,
               0,
               A4[0],
               A4[1],
               leftPadding=31.8 * mm,
               bottomPadding=25.4 * mm,
               rightPadding=31.8 * mm,
               topPadding=25.4 * mm)
     ],
                             onPageEnd=self.footer)
     # 定义页面模版,页脚可有可无
     self.addPageTemplates(template)  # 加入页面模版
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     frameT = Frame(self.leftMargin,
                    self.bottomMargin,
                    self.width,
                    self.height,
                    id='F1')
     template_title_page = PageTemplate('title_page',
                                        frames=frameT,
                                        onPage=title_page)
     template_later_pages = PageTemplate('later_pages',
                                         frames=frameT,
                                         onPage=later_pages)
     self.addPageTemplates(template_title_page)
     self.addPageTemplates(template_later_pages)
示例#35
0
    def __init__(self, filename, cfgparser, **kw):
        self.allowSplitting = 0
        # Inch graph size (width, height)
        self.graph_size = (float(cfgparser.get("page", "graph_width")),
                           float(cfgparser.get("page", "graph_height")))
        self.x_axis = ('Time', 12, '%m-%d %H:%M', 20)
        self.tablestyle = [
            ('ROWBACKGROUNDS', (0, 0), (-1, -1), (colors.lightgrey, colors.white)),
            ('GRID', (0, 0), (-1, -1), 1, colors.toColor(cfgparser.get("string_table", "color"))),
            ('ALIGN', (0, 0), (-1, -1), cfgparser.get("string_table", "align")),
            ('LEFTPADDING', (0, 0), (-1, -1), int(cfgparser.get("string_table", "leftPadding"))),
            ('RIGHTPADDING', (0, 0), (-1, -1), int(cfgparser.get("string_table", "rightPadding"))),
            ('FONTSIZE', (0, 0), (-1, -1), int(cfgparser.get("string_table", "fontSize"))),
            ('FONTNAME', (0, 0), (-1, 0), cfgparser.get("string_table", "font")), ]
        BaseDocTemplate.__init__(self, filename, **kw)
        template = PageTemplate('normal', [Frame(
            float(cfgparser.get("page", "x1")) * inch,
            float(cfgparser.get("page", "y1")) * inch,
            float(cfgparser.get("page", "width")) * inch,
            float(cfgparser.get("page", "height")) * inch,
            id='F1')])
        self.addPageTemplates(template)

        font_list = ["centered", "centered_index", "small_centered",
                     "heading1", "heading1_centered", "heading1_invisible",
                     "heading2", "heading2_centered", "heading2_invisible",
                     "mono", "mono_centered", "normal", "front_title", "axes"]
        int_fields = ["fontSize", "leading", "alignment", "spaceAfter"]
        self.fonts = {}
        for font in font_list:
            sheet = getSampleStyleSheet()
            text = sheet['BodyText']
            section = "font_%s" % font
            items = dict(cfgparser.items(section))
            for i in int_fields:
                if i in items:
                    items[i] = int(items[i])

            tmp_ps = PS(font, parent=text)
            tmp_ps.__dict__.update(items)
            self.fonts[font] = tmp_ps
示例#36
0
    def __init__(self, filename, **kw):
        frame1 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id='F1')
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template1 = PageTemplate('normal', [frame1], myMainPageFrame)

        frame2 = Frame(2.5 * cm,
                       16 * cm,
                       15 * cm,
                       10 * cm,
                       id='F2',
                       showBoundary=1)
        frame3 = Frame(2.5 * cm,
                       2.5 * cm,
                       15 * cm,
                       10 * cm,
                       id='F3',
                       showBoundary=1)

        greenBoundary = ShowBoundaryValue(color=toColor('darkgreen'),
                                          width=0.5)
        templateX = PageTemplate('templateX', [
            Frame(3 * cm,
                  7.5 * cm,
                  14 * cm,
                  4 * cm,
                  id='XF4',
                  showBoundary=greenBoundary),
            Frame(3 * cm,
                  2.5 * cm,
                  14 * cm,
                  4 * cm,
                  id='XF5',
                  showBoundary=greenBoundary)
        ])

        template2 = PageTemplate('updown', [frame2, frame3])
        self.addPageTemplates([template1, template2, templateX])
示例#37
0
 def __init__(self,
              filename,
              sprint=None,
              logo_orange=None,
              logo_phoenix=None,
              team_img=None,
              **kw):
     self.allowSplitting = 0
     self.sprint = sprint
     self.name_report = split(filename)[1]
     self.logo_orange = logo_orange
     self.logo_phoenix = logo_phoenix
     self.team_img = team_img
     self.orangeColor = colors.Color(1, 0.47, 0)
     self.styles = getSampleStyleSheet()
     self.styles.add(
         ParagraphStyle(name='TitlePage',
                        parent=self.styles['Normal'],
                        fontSize=32,
                        textColor=self.orangeColor))
     self.styles.add(
         ParagraphStyle(name='Link',
                        parent=self.styles['Normal'],
                        textColor=self.orangeColor))
     BaseDocTemplate.__init__(self, filename, **kw)
     frame = Frame(self.leftMargin,
                   self.bottomMargin,
                   self.width,
                   self.height,
                   id='normal')
     self.addPageTemplates([
         PageTemplate(id='First',
                      frames=frame,
                      onPage=lambda c, d: self.first_page(c)),
         PageTemplate(id='OneCol',
                      frames=frame,
                      onPageEnd=lambda c, d: self.foot_page(c)),
     ])
示例#38
0
	def __init__(self, filename, **kw):
		
		self.allowSplitting = 0
		BaseDocTemplate.__init__(self, filename, **kw)

		self.pagesize = A4
		self.topMargin = 0.5*cm
		self.bottomMargin = 2*cm
		self.leftMargin = 1*cm
		self.rightMargin = 1*cm
		self._calc()

		frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, 
			id='normal', showBoundary=0)
		# Table of contents padding
		tocP = 3*cm
		frameTOC = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, 
			leftPadding=tocP, rightPadding=tocP, id='toc', showBoundary=0)

		titleTemplate = PageTemplate('title', frames=frameT, onPage=titlePage)
		tocTemplate =PageTemplate('toc', frames=frameTOC, onPage=tocPage)
		template = PageTemplate('normal', frames=frameT, onPage=defaultPage)
		
		self.addPageTemplates([titleTemplate, tocTemplate, template])
示例#39
0
    def __init__(self, filename, **kw):
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template = PageTemplate(
            'normal',
            [Frame(0.1 * inch, 0.1 * inch, 11 * inch, 8 * inch, id='F1')])
        self.addPageTemplates(template)

        self.centered = PS(name='centered',
                           fontSize=30,
                           leading=16,
                           alignment=1,
                           spaceAfter=20)

        self.centered_index = PS(name='centered_index',
                                 fontSize=24,
                                 leading=16,
                                 alignment=1,
                                 spaceAfter=20)

        self.small_centered = PS(name='small_centered',
                                 fontSize=14,
                                 leading=16,
                                 alignment=1,
                                 spaceAfter=20)

        self.h1 = PS(name='Heading1', fontSize=16, leading=16)

        self.h2 = PS(name='Heading2', fontSize=14, leading=14)

        self.h2_center = PS(name='Heading2Center',
                            alignment=1,
                            fontSize=14,
                            leading=14)

        self.h2_invisible = PS(name='Heading2Invisible',
                               alignment=1,
                               textColor='#FFFFFF',
                               fontSize=14,
                               leading=14)

        self.mono = PS(name='Mono',
                       fontName='Courier',
                       fontSize=16,
                       leading=16)

        self.normal = PS(name='Normal', fontSize=16, leading=16)

        self.toc = TableOfContents()
        self.toc.levelStyles = [
            PS(fontName='Times-Bold',
               fontSize=14,
               name='TOCHeading1',
               leftIndent=20,
               firstLineIndent=-20,
               spaceBefore=2,
               leading=16),
            PS(fontSize=10,
               name='TOCHeading2',
               leftIndent=40,
               firstLineIndent=-20,
               spaceBefore=0,
               leading=8),
        ]
示例#40
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.pagesize = defaultPageSize
示例#41
0
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(PageTemplate('normal', [frame1], mainPageFrame))
示例#42
0
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(PageTemplate('normal', [frame1], mainPageFrame))
示例#43
0
 def __init__(self, filename, **kw):
     #self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate(
         'normal', [Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id='F1')])
     self.addPageTemplates(template)
    def __init__(self, filename, **kw):

        BaseDocTemplate.__init__(self, filename, pagesize=A8, **kw)
        template = PageTemplate("normal", [Frame(0 * mm, 0 * mm, A8[0], A8[1], id="F1")])
        self.addPageTemplates(template)
示例#45
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     self.addPageTemplates(
         [
             PageTemplate(
                 "normal",
                 [
                     Frame(
                         inch,
                         inch,
                         6.27 * inch,
                         9.69 * inch,
                         id="first",
                         topPadding=0,
                         rightPadding=0,
                         leftPadding=0,
                         bottomPadding=0,
                         showBoundary=ShowBoundaryValue(color="red"),
                     )
                 ],
                 onPage=onPage("normal"),
             ),
             PageTemplate(
                 "auto",
                 [
                     Frame(
                         inch,
                         inch,
                         6.27 * inch,
                         9.69 * inch,
                         id="first",
                         topPadding=0,
                         rightPadding=0,
                         leftPadding=0,
                         bottomPadding=0,
                         showBoundary=ShowBoundaryValue(color="red"),
                     )
                 ],
                 onPage=onPage("auto"),
                 autoNextPageTemplate="autoFollow",
             ),
             PageTemplate(
                 "autoFollow",
                 [
                     Frame(
                         inch,
                         inch,
                         6.27 * inch,
                         9.69 * inch,
                         id="first",
                         topPadding=0,
                         rightPadding=0,
                         leftPadding=0,
                         bottomPadding=0,
                         showBoundary=ShowBoundaryValue(color="red"),
                     )
                 ],
                 onPage=onPage("autoFollow"),
             ),
         ]
     )
示例#46
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate('normal', [Frame(FRAME_BORDER,FRAME_BORDER,21*cm-2*FRAME_BORDER,29.7*cm-2*FRAME_BORDER, id='F1')])
     self.addPageTemplates(template)
示例#47
0
    def __init__(self, filename, **kw):
        self.allowSplitting = 0
        BaseDocTemplate.__init__(self, filename, **kw)
        template = PageTemplate('normal', [Frame(0.1 * inch, 0.1 * inch,
                                11 * inch, 8 * inch, id='F1')])
        self.addPageTemplates(template)

        self.centered = PS(
            name='centered',
            fontSize=30,
            leading=16,
            alignment=1,
            spaceAfter=20)

        self.centered_index = PS(
            name='centered_index',
            fontSize=24,
            leading=16,
            alignment=1,
            spaceAfter=20)

        self.small_centered = PS(
            name='small_centered',
            fontSize=14,
            leading=16,
            alignment=1,
            spaceAfter=20)

        self.h1 = PS(
            name='Heading1',
            fontSize=16,
            leading=16)

        self.h2 = PS(
            name='Heading2',
            fontSize=14,
            leading=14)

        self.h2_center = PS(
            name='Heading2Center',
            alignment=1,
            fontSize=14,
            leading=14)

        self.h2_invisible = PS(
            name='Heading2Invisible',
            alignment=1,
            textColor='#FFFFFF',
            fontSize=14,
            leading=14)

        self.mono = PS(
            name='Mono',
            fontName='Courier',
            fontSize=16,
            leading=16)

        self.normal = PS(
            name='Normal',
            fontSize=16,
            leading=16)

        self.toc = TableOfContents()
        self.toc.levelStyles = [
            PS(fontName='Times-Bold', fontSize=14, name='TOCHeading1',
                leftIndent=20, firstLineIndent=-20, spaceBefore=2, leading=16),
            PS(fontSize=10, name='TOCHeading2', leftIndent=40,
                firstLineIndent=-20, spaceBefore=0, leading=8),
        ]
示例#48
0
 def __init__(self, filename, **kw):
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
 def __init__(self, filename, **kw):
     frame1 = Frame(2.5 * cm, 2.5 * cm, 15 * cm, 25 * cm, id="F1")
     self.allowSplitting = 0
     BaseDocTemplate.__init__(self, filename, **kw)
     template = PageTemplate("normal", [frame1], myMainPageFrame)
     self.addPageTemplates(template)
 def __init__(self, filename, **kwargs):
     BaseDocTemplate.__init__(self, filename, **kwargs)
     frame1 = Frame(self.leftMargin, self.bottomMargin, self.width/2-6, self.height, id='col1', leftPadding=0, rightPadding=10, showBoundary=0)
     frame2 = Frame(self.leftMargin+self.width/2+6, self.bottomMargin, self.width/2-6, self.height, id='col2', leftPadding=10, rightPadding=0, showBoundary=0)
     self.addPageTemplates([PageTemplate(id='TwoCol',frames=[frame1,frame2],onPage=self._do_footer),])