def getPrintView(lang, imagepath, metadata, paths, style=1, children=[], collection=None): # style=1: object, style=3: liststyle """ returns pdf content of given item """ if not reportlab: return None pv = PrintPreview(lang, config.get("host.name")) pv.setHeader(collection) if style == 1 or style == 2: # single object (with children) pv.addImage(imagepath) pv.addData(FrameBreak()) pv.addMetaData(metadata) pv.addPaths(paths) if len(children) > 0: pv.addData(FrameBreak()) pv.addChildren(children) elif style == 3: # objectlist pv.addData(Paragraph(t(pv.language, "print_view_list"), pv.bp)) pv.addChildren(children) printfile = tempfile.mkstemp(suffix='.pdf', prefix='print_', dir=config.get("paths.tempdir")) p = Process(target=pv.build, args=( printfile, style, )) p.start() p.join(timeout=30) if p.is_alive(): p.terminate() try: fh = open(printfile[1], 'r') print_template = fh.read() fh.close except IOError: print_template = "" try: os.remove(printfile[1]) except IOError: pass return print_template
def getPrintView(lang, imagepath, metadata, paths, style=1, children=[], collection=None, return_file=False, print_dir=None): # style=1: object, style=3: liststyle """ returns pdf content of given item """ if not reportlab: return None pv = PrintPreview(lang, config.get("host.name")) pv.setHeader(collection) if style == 1 or style == 2: # single object (with children) pv.addImage(imagepath) pv.addData(FrameBreak()) pv.addMetaData(metadata) pv.addPaths(paths) if len(children) > 0: pv.addData(FrameBreak()) pv.addChildren(children) elif style == 3: # objectlist pv.addData(Paragraph(t(pv.language, "print_view_list"), pv.bp)) pv.addChildren(children) printdir = tempfile.mkdtemp(prefix='print_', dir=config.get("paths.tempdir")) try: printfile = os.path.join(printdir, "printview.pdf") p = Process(target=pv.build, args=(printfile, )) p.start() p.join(timeout=60) if p.is_alive(): p.terminate() if return_file: if isinstance(print_dir, list): print_dir.append(printdir) return printfile else: with open(printfile) as f: return f.read() except Exception as e: logg.exception("exception in getPrintView") finally: if not return_file: shutil.rmtree(printdir, ignore_errors=True)
def addContent(recipes): styles = getSampleStyleSheet() styles.add(ParagraphStyle(name='Ingredients', fontName='Courier', fontSize=8, leading=8)) styles.add(ParagraphStyle(name='Directions', fontName='Helvetica', spaceafter=10, fontSize=8, leading=8)) #print(styles) styleDirections = styles['Directions'] styleH = styles['Heading1'] styleIngredients = styles['Ingredients'] contentList = [] for recipe in recipes: print("Processing: " + recipe['title']) #Title contentList.append(Paragraph(recipe['title'], styleH)) contentList.append(FrameBreak()) #Ingredients groupEnd = False for ingredient in recipe['ingredients']: if ingredient == ' ': groupEnd = True continue output = ingredient['thing'] if groupEnd == True: output = '<para spacebefore=10>' + output + '</para>' groupEnd = False contentList.append(Paragraph(output, styleIngredients)) contentList.append(FrameBreak()) #Units for ingredient in recipe['ingredients']: if ingredient == ' ': groupEnd = True continue output = ingredient['m-unit'] if groupEnd == True: output = '<para spacebefore=10>' + output + '</para>' groupEnd = False contentList.append(Paragraph(output, styleIngredients)) contentList.append(FrameBreak()) #Directions for line in recipe['directions']: output = line contentList.append(Paragraph('<para spaceafter=10>' + output + '</para>', styleDirections)) contentList.append(FrameBreak()) return contentList
def run(in_data, out_file_path, frame_border=0): story = [] # FirstPage Template is already active and will draw its stuff before the PageBreak story.append(NextPageTemplate('ContentPage')) story.append(PageBreak()) files = in_data['image_files'] for f in files: story.append( Paragraph( f"Chunk {f['chunk_idx']} / {in_data['meta']['chunks_total']}")) story.append(Spacer(width=0, height=5 * mm)) img_dim = (page_width / 2) - 50 * mm story.append( Image(f['chunk_img_path'], width=img_dim, height=img_dim, hAlign='LEFT')) story.append(FrameBreak()) doc = qr_code_doc_template(in_metadata=in_data['meta'], out_file_path=out_file_path, frame_border=frame_border, pagesize=A4) doc.multiBuild(story)
def build_page(self, template_id, flowable_map): """Build a pdf page by looking up the specified template and then mapping the flowable_map items to the appropriate named Frame """ pt = self.get_page_template(template_id) # If this is the first page then ensure the page template is ordered first and no breaks or changes # are requested otherwise blank page shows up if self.active_template_id is None: self.make_template_first(template_id) self.story.append(NextPageTemplate(template_id)) self.inc_cover and self.story.append(PageBreak()) self.active_template_id = template_id elif self.active_template_id == template_id: # TODO - understand why this is necessary to not get a blank page between pages self.story.append(PageBreak()) else: self.story.append(NextPageTemplate(template_id)) self.story.append(PageBreak()) self.active_template_id = template_id for idx, frame in enumerate(pt.frames): if frame.id not in flowable_map: # Add a note to the template to show that nothing was defined for this area self.story.append(Paragraph('NOT DEFINED: %s' % frame.id, getSampleStyleSheet()['Normal'])) else: flowables = flowable_map[frame.id] if not isinstance(flowables, Flowable) and hasattr(flowables, '__iter__'): [self.story.append(f) for f in flowables] else: self.story.append(flowables) if idx < (len(pt.frames) - 1): self.story.append(FrameBreak()) return self
def add_h_dotted_line(x,y,width): obj = flow.HRFlowable_dotted(width) obj_frame = Frame(x,y,width,1,id=str('h_dotted_line'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(obj_frame) page_elements.append(obj) page_elements.append(FrameBreak())
def add_v_dotted_line(x,y,lheight): obj = flow.VRFlowable_dotted(lheight) obj_frame = Frame(x,y,0,lheight,id=str('v_dotted_line'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(obj_frame) page_elements.append(obj) page_elements.append(FrameBreak())
def produce(self, context): for sem in range(1, 7): modules = [ m for m in context['modules'] if getattr(m, 'sem{0}'.format(sem)) ] total = context['tot{0}'.format(str(sem))] data = [['Semestre {0}'.format(sem), '{0} h.'.format(total)]] for line in modules: value = getattr(line, 'sem{0}'.format(sem)) data.append([line.nom, '{0} h.'.format(value)]) t = Table(data=data, colWidths=[6 * cm, 1 * cm], spaceBefore=0 * cm, spaceAfter=0.5 * cm, hAlign=TA_LEFT, style=[ ('ALIGN', (0, 0), (0, -1), 'LEFT'), ('ALIGN', (1, 0), (1, -1), 'RIGHT'), ('LINEBELOW', (0, 0), (1, 0), 1, colors.black), ('SIZE', (0, 0), (-1, -1), 8), ('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'), ]) self.story.append(t) self.story.append(FrameBreak()) self.story.append( Paragraph( 'Total de la formation: {0} heures'.format(context['tot']), style_bold)) self.build(self.story)
def build_scan_page(doc, Story, scan_number, title, text, overviewmap_image_filepath, scan_params, scan_image_filepaths): ### text section headerstr = 'Scan ' + str(scan_number) + ': ' + title subheaderstr = [] subheaderstr.append('\tArea: {0:d} x {1:d} um'.format( scan_params['x_range'], scan_params['y_range'])) subheaderstr.append('\tStep Size: {0:s} um'.format( scan_params['stepsize'])) subheaderstr.append('\tDwell Time: {0:s} ms'.format( scan_params['dwell'])) subheaderstr.append('\tEnergy: {0:s} keV'.format( scan_params['energy'])) Story.append(Paragraph(headerstr, styles['Heading1'])) for each in subheaderstr: Story.append(Paragraph(each, styles['Heading3'])) Story.append(Paragraph(text, styles['Normal'])) # Story.append(PageBreak()) Story.append(FrameBreak()) ### overview map section imoverview = ScaledImage(overviewmap_image_filepath, 'width', doc.width * 0.45) Story.append(imoverview) Story.append(FrameBreak()) # Story.append(PageBreak()) ###integrated xrf spectrum # imspectrum = ScaledImage(integratedspectrum_image_filepath, 'width', doc.width * 0.45) ### xrf maps section # frame = doc.getFrame('xrfframe') # width = frame._aW # height = frame.aH imtable = generate_image_matrix(scan_image_filepaths, max_num_cols=4, max_width=doc.width + doc.leftMargin, max_height=doc.height * 0.62) Story.append(imtable) # Story.append(PageBreak()) return Story
def add_text_wback(content,x,y,size): obj = flow.text_wback(content,x,y,size) size_x,size_y = size obj_frame = Frame(x*mm,y*mm,size_x,size_y,id=str('obj'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(obj_frame) page_elements.append(obj) page_elements.append(FrameBreak())
def add_text(header,body,x,y,scale = 1): text_obj = flow.offer_text(header,body,scale = scale) size_x,size_y = text_obj.content_width,text_obj.content_height text_frame = Frame(x*mm,y*mm,size_x,size_y,id=str('text_main'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(text_frame) page_elements.append(text_obj) page_elements.append(FrameBreak())
def add_text_string(x,y,font,font_size,string,color = '#FFFFFF',border = True): obj = flow.text_string.init(string,font,font_size,color,border) size_x,size_y = obj.content_width,obj.content_height obj_frame = Frame(x*mm,y*mm,size_x,size_y,id=str('text_string'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(obj_frame) page_elements.append(obj) page_elements.append(FrameBreak())
def build_title_page(doc, Story, title, subtitle): styles = getSampleStyleSheet() styles.add( ParagraphStyle(name='CenterTitle', fontSize=24, alignment=TA_CENTER)) styles.add( ParagraphStyle(name='CenterSubtitle', fontSize=16, alignment=TA_CENTER)) Story.append(Paragraph(title, styles['CenterTitle'])) Story.append(FrameBreak()) Story.append(Paragraph(subtitle, styles['CenterSubtitle'])) Story.append( Paragraph(datetime.today().strftime('%Y-%m-%d'), styles['CenterSubtitle'])) Story.append(NextPageTemplate('ScanPage')) Story.append(FrameBreak()) # Story.append(PageBreak()) return (Story)
def add_price(price,x,y,scale = 1): price_rub,price_kop = price.split('.')[0],price.split('.')[1] price_obj = flow.Price_std(price_rub,price_kop,scale=scale) size_x,size_y = price_obj.content_width,price_obj.content_height price_frame = Frame(x*mm,y*mm,size_x,size_y,id=str('price_main'),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(price_frame) page_elements.append(price_obj) page_elements.append(FrameBreak())
def build_comparison_page(doc, Story, title, subtitle, comparisondict): margin = 0.99 num_columns = len(comparisondict) Story.append(Paragraph(title, styles['Heading1'])) Story.append(Paragraph(subtitle, styles['Normal'])) #columns for _, vals in comparisondict.items(): Story.append(FrameBreak()) Story.append(Paragraph(vals['description'], styles['Normal'])) Story.append(FrameBreak()) imtable = generate_image_matrix(vals['impaths'], max_num_cols=1, max_width=doc.width / num_columns * margin, max_height=doc.height * 0.4) Story.append(imtable) return (Story)
def print_problem(self): """ Print the problem of the ticket """ self.story.append( Paragraph('Περιγραφή Προβήματος', self.styleH) ) self.story.append( Paragraph(self.ticket.problem, self.styleB) ) self.story.append(FrameBreak())
def print_actions(self): """ Print the actions of the ticket """ self.story.append( Paragraph('Ενέργειες Τεχνικού', self.styleH) ) self.story.append( Paragraph(self.ticket.actions, self.styleB) ) self.story.append(FrameBreak())
def print_diagnosis(self): """ Print the diagnosis of the ticket """ self.story.append( Paragraph('Διάγνωση Προβλήματος', self.styleH) ) self.story.append( Paragraph(self.ticket.diagnosis, self.styleB) ) self.story.append(FrameBreak())
def get_image_story(impath, imw=80, imh=60, title=None, style=None): out_story = [FrameBreak()] img = svg2rlg(impath) scaling_factor = imw*mm/img.width img.width = imw*mm img.height = imh*mm img.scale(scaling_factor, scaling_factor) out_story.append(img) if title and style: out_story.append(Paragraph("<font color='#95C11E' name=Arial-bold>{}</font>".format(title), style)) return out_story
def __init__(self, items=[], title='', pretext=''): super(Checklist, self).__init__(title, pretext) FRAMEBREAK = PDF.Item(_type='FRAMEBREAK',\ order=len(self.story) + 1,\ data=FrameBreak()) self.story.append(FRAMEBREAK) NEXTPAGETEMPLATE = PDF.Item(_type='TEMPLATE',\ order=len(self.story) + 1,\ data=NextPageTemplate('LaterPages')) self.story.append(NEXTPAGETEMPLATE) if items: items = flatten(items) self.add(items)
def build_scan_page(doc, Story, scan_number, title, text, overviewmap_image_filepath, scan_params, scan_image_filepaths): ### text section headerstr = 'Scan ' + str(scan_number) + ': ' + title subheaderstr = [] subheaderstr.append('\tArea: {0:d} x {1:d} um'.format( scan_params['x_range'], scan_params['y_range'])) subheaderstr.append('\tStep Size: {0:s} um'.format( scan_params['stepsize'])) subheaderstr.append('\tDwell Time: 50 ms') subheaderstr.append('\tEnergy: 16.3 keV') Story.append(Paragraph(headerstr, styles['Heading1'])) for each in subheaderstr: Story.append(Paragraph(each, styles['Heading3'])) Story.append(Paragraph(text, styles['Normal'])) # Story.append(PageBreak()) Story.append(FrameBreak()) ### overview map section imoverview = ScaledImage(overviewmap_image_filepath, 'width', doc.width * 0.45) Story.append(imoverview) Story.append(FrameBreak()) # Story.append(PageBreak()) ### xrf maps section imtable = generate_image_matrix(scan_image_filepaths, max_num_cols=4, max_width=doc.width, max_height=doc.height * 0.6) Story.append(imtable) Story.append(FrameBreak()) # Story.append(PageBreak()) return Story
def getPrintView(lang, imagepath, metadata, paths, style=1, children=[], collection=None): # style=1: object, style=3: liststyle """ returns pdf content of given item """ if not reportlab: return None pv = PrintPreview(lang, config.get("host.name")) pv.setHeader(collection) if style == 1 or style == 2: # single object (with children) pv.addImage(imagepath) pv.addData(FrameBreak()) pv.addMetaData(metadata) pv.addPaths(paths) if len(children) > 0: pv.addData(FrameBreak()) pv.addChildren(children) elif style == 3: # objectlist pv.addData(Paragraph(t(pv.language, "print_view_list"), pv.bp)) pv.addChildren(children) return pv.build(style)
def content(job): """Create a list of flowables with all the content for the cutlist.""" result = [] result.append(hdr_table(job)) result.append(FrameBreak()) result.append(Paragraph('Overview:', heading_style)) for line in job.summaryln: result.append(Paragraph(line, normal_style)) result.append(Spacer(1, 10)) for line in job.cabinfo: result.append(Paragraph(line, normal_style)) result.append(Spacer(1, 10)) for line in job.materialinfo: result.append(Paragraph(line, normal_style)) result.append(Spacer(1, 24)) result.append(isometric_view(job)) result.append(FrameBreak()) result.append(panels_table(job)) result.append(Paragraph('Parts List:', heading_style)) for line in job.partslist: result.append(XPreformatted(line, fixed_style)) return result
def add_image(path,x,y,size): #setting image vars image_path = path x = x*mm y = y*mm size_x = size[0]*mm size_y = size[1]*mm #setting frame image_frame = Frame(x,y,size_x,size_y,id=str(path),bottomPadding=0,topPadding=0,leftPadding=0) page_frames.append(image_frame) #setting object in frame: image = Image(image_path,size_x,size_y,mask=[0,255, 0,255, 0,255]) page_elements.append(image) page_elements.append(FrameBreak())
def build(self, style=1): self.h1 = self.styleSheet['Heading1'] self.h1.fontName = 'Helvetica' self.bv = self.styleSheet['BodyText'] self.bv.fontName = 'Helvetica' self.bv.fontSize = 7 self.bv.spaceBefore = 0 self.bv.spaceAfter = 0 self.header = self.styleSheet['Heading3'] self.header.fontName = 'Helvetica' self.data.append(Paragraph(translation.t(self.language, 'mediatumhelptitle'), self.h1)) self.data.append(Paragraph(self.path, self.bv)) self.data.append((FrameBreak())) # format content self.content = self.content.replace("\n", "") repl = {'p': 'BodyText', 'h1': 'Heading1', 'h2': 'Heading2', 'h3': 'Heading3', 'h4': 'Heading4', 'h5': 'Heading5', 'li': 'Bullet'} curstyle = "BodyText" for item in re.split(r'<(p|h[1-5]|li)>|<(/p|/h[1-5]|/li)>', self.content): if item and item != "": if item in repl.keys(): curstyle = repl[item] elif item[0] == "/" and item[1:] in repl.keys(): curstyle = "" else: if item.strip != "" and curstyle != "": print 'add', item, "-->", curstyle if curstyle == "Bullet": item = "- " + item print "bullet", item self.data.append(Paragraph(item, self.styleSheet[curstyle])) template = SimpleDocTemplate(config.get("paths.tempdir", "") + "help.pdf", showBoundary=0) tFirst = PageTemplate(id='First', onPage=self.myPages, pagesize=defaultPageSize) tNext = PageTemplate(id='Later', onPage=self.myPages, pagesize=defaultPageSize) template.addPageTemplates([tFirst, tNext]) template.allowSplitting = 1 BaseDocTemplate.build(template, self.data) template.canv.setAuthor(translation.t(self.language, "main_title")) template.canv.setTitle("%s \n'%s' - %s: %s" % (translation.t(self.language, "edit_stats_header"), 'sdfsdfsdf', translation.t(self.language, "edit_stats_period_header"), '2003')) return template.canv._doc.GetPDFData(template.canv)
def setHeader(self, collection): h1 = self.styleSheet['Heading1'] h1.fontName = 'Helvetica' if not collection: self.header = Paragraph(t(self.language, "print_view_header"), h1) else: p = Paragraph(t(self.language, collection.name), h1) p.wrap(defaultPageSize[0], defaultPageSize[1]) self.headerWidth = p.getActualLineWidths0()[0] self.header = p self.addData(self.header) self.addData(FrameBreak()) if len(collection.get("system.logo")) > 1: for f in collection.getFiles(): fn = f.getName() if fn.endswith(collection.get("system.logo")): self.addImage(f.retrieveFile(), 1)
def add_image(path,x,y,size): #setting image vars image_path = path x = x y = y print 'size', size size_x = size[0]*mm size_y = size[1]*mm #setting frame image_frame = Frame(x,y,size_x,size_y,id=str(path),bottomPadding=0,topPadding=0,leftPadding=0,rightPadding=0) page_frames.append(image_frame) #setting object in frame: #image = Image(image_path,size_x,size_y,mask='auto') image_obj = flow.image.init(image_path,size_x,size_y) page_elements.append(image_obj) page_elements.append(FrameBreak())
def print_client_info(self): """ Prints the client info to the pdf """ self.story.append( Paragraph('Πληροφορίες Πελάτη', self.styleH) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Πελάτης: </font>{0}'.format(self.ticket.client.full_name()), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Σταθερό: </font>{0}'.format(self.ticket.client.landline()), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Κινητό: </font>{0}'.format(self.ticket.client.mobile_phone()), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Service ID: </font>{0}'.format(self.ticket.id), self.styleN) ) self.story.append(FrameBreak())
def print_device_info(self): """ Prints the device info to the pdf """ self.story.append( Paragraph('Πληροφορίες Συσκευής', self.styleH) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Ημερομηνία Εισαγωγής: </font>{0}'.format(self.ticket.admission_date.strftime("%d-%m-%Y")), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Ημερομηνία Εξαγωγής: </font>{0}'.format(self.ticket.discharge_full_date()), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>Συσκευή: </font>{0}'.format(self.ticket.device.model), self.styleN) ) self.story.append( Paragraph('<font color=(0,0.6,0.8)>S/N: </font>{0}'.format(self.ticket.device.serial_number), self.styleN) ) self.story.append(FrameBreak())
def _create_invoice(invoice_buffer, invoice, proposal): global DPAW_HEADER_LOGO # if cols_var["TEMPLATE_GROUP"] == 'rottnest': # DPAW_HEADER_LOGO = os.path.join(settings.BASE_DIR, 'mooring', 'static', 'mooring', 'img','logo-rottnest-island-sm.png') # else: # DPAW_HEADER_LOGO = os.path.join(settings.BASE_DIR, 'ledger', 'payments','static', 'payments', 'img','dbca_logo.jpg') DPAW_HEADER_LOGO = os.path.join(settings.PROJECT_DIR, 'payments', 'static', 'payments', 'img', 'dbca_logo.jpg') every_page_frame = Frame(PAGE_MARGIN, PAGE_MARGIN + 250, PAGE_WIDTH - 2 * PAGE_MARGIN, PAGE_HEIGHT - 450, id='EveryPagesFrame', showBoundary=0) remit_frame = Frame(PAGE_MARGIN, PAGE_MARGIN, PAGE_WIDTH - 2 * PAGE_MARGIN, PAGE_HEIGHT - 600, id='RemitFrame', showBoundary=0) every_page_template = PageTemplate(id='EveryPages', frames=[every_page_frame, remit_frame], onPage=_create_header) doc = BaseDocTemplate(invoice_buffer, pageTemplates=[every_page_template], pagesize=A4) # this is the only way to get data into the onPage callback function doc.invoice = invoice doc.proposal = proposal owner = invoice.owner elements = [] #elements.append(Spacer(1, SECTION_BUFFER_HEIGHT * 5)) # Draw Products Table invoice_table_style = TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP'), ('GRID', (0, 0), (-1, -1), 1, colors.black), ('ALIGN', (0, 0), (-1, -1), 'LEFT')]) items = invoice.order.lines.all() discounts = invoice.order.basket_discounts if invoice.text: elements.append(Paragraph(invoice.text, styles['Left'])) elements.append(Spacer(1, SECTION_BUFFER_HEIGHT * 2)) data = [['Item', 'Product', 'Quantity', 'Unit Price', 'Total']] val = 1 s = styles["BodyText"] s.wordWrap = 'CJK' for item in items: data.append([ val, Paragraph(item.description, s), item.quantity, currency(item.unit_price_incl_tax), currency(item.line_price_before_discounts_incl_tax) ]) val += 1 # Discounts data.append(['', '', '', '']) for discount in discounts: data.append( ['', discount.offer, '', '', '-${}'.format(discount.amount)]) val += 1 t = Table(data, style=invoice_table_style, hAlign='LEFT', colWidths=( 0.7 * inch, None, 0.7 * inch, 1.0 * inch, 1.0 * inch, )) elements.append(t) elements.append(Spacer(1, SECTION_BUFFER_HEIGHT * 2)) # /Products Table if invoice.payment_status != 'paid' and invoice.payment_status != 'over_paid': elements.append( Paragraph(settings.INVOICE_UNPAID_WARNING, styles['Left'])) elements.append(Spacer(1, SECTION_BUFFER_HEIGHT * 6)) # Remitttance Frame elements.append(FrameBreak()) boundary = BrokenLine(PAGE_WIDTH - 2 * (PAGE_MARGIN * 1.1)) elements.append(boundary) elements.append(Spacer(1, SECTION_BUFFER_HEIGHT)) remittance = Remittance(HEADER_MARGIN, HEADER_MARGIN - 10, proposal, invoice) elements.append(remittance) #_create_remittance(invoice_buffer,doc) doc.build(elements) return invoice_buffer