Here's a simple example, creating a PDF invoice in web2py app: This is the controller code: def show_pdf_invoice(invoice_number, invoice): from fpdf import FPDF
pdf = FPDF() pdf.add_page() pdf.set_font('Arial', 'B', 10) pdf.cell(25, 5, 'My company name', ) pdf.set_font('Arial', '', 10) pdf.cell(60, 5, 'My company address', ln=1) pdf.cell(40, 5, 'My company additional data', ln=1) pdf.line(10, 20, 180, 20) pdf.set_xy(140, 25) pdf.cell(25, 5, 'Date issued: {0}'.format(invoice[0].date)) pdf.set_xy(140, 30) pdf.cell(25, 5, 'Invoice Number: {0}'.format(str(invoice_number))) pdf.line(10, 40, 180, 40) pdf.set_xy(10, 41) pdf.cell(30, 5, 'Description') pdf.cell(30, 5, 'Starts') pdf.cell(30, 5, 'End') pdf.cell(30, 5, 'Amount') pdf.line(10, 46, 180, 46) pdf.set_xy(10, 47) pdf.cell(30, 5, invoice[0].invoice_item_name) pdf.cell(30, 5, '') pdf.cell(30, 5, '') pdf.cell(30, 5, '{0} {1}'.format(invoice[0].total, invoice[0].currency) pdf.line(10, 51, 180, 51) pdf.set_xy(150, 52) pdf.cell(30, 5, 'Total: {0} {1}'.format(invoice[0].total, invoice[0]. currency) pdf.set_xy(10, 60) pdf.cell(30, 5, 'Bill To:', 0, 1) pdf.cell(30, 5, invoice[0].invoice_address_name, 0, 1) pdf.cell(30, 5, invoice[0].invoice_address_street, 0, 1) pdf.cell(30, 5, invoice[0].invoice_address_city) pdf.cell(30, 5, invoice[0].invoice_address_zip, 0, 1) pdf.cell(30, 5, invoice[0].invoice_address_country) pdf.output('invoice.pdf', 'F') response.headers['Content-Type'] = 'application/pdf' return XML(pdf.output('', 'S')) And that's it, your view named "show_pdf_invoice.html" should be empty. On Monday, May 16, 2016 at 12:19:08 PM UTC+2, prashant joshi wrote: > > i also try this but i could not understad....please anybody send a simple > example that i will understd > > On Wed, May 11, 2016 at 1:57 AM, Carlos Cesar Caballero Díaz < > desar...@spicm.cfg.sld.cu <javascript:>> wrote: > >> Take a look to jsPDF (https://parall.ax/products/jspdf) if you are more >> familiar with javascript. >> >> >> >> El 10/05/16 a las 15:52, Jim S escribió: >> >> I use ReportLab... >> >> -Jim >> >> On Tuesday, May 10, 2016 at 1:40:42 PM UTC-5, José L. wrote: >>> >>> Latest fpdf code is in the contrib section of gluon libraries, and works >>> correctly. If your report is not too complicated I'd recommend you this >>> way. The demo from the above link is easy to follow. >>> >>> 2016-05-10 20:26 GMT+02:00 Dave S <snide...@gmail.com>: >>> >>>> On Tuesday, May 10, 2016 at 9:59:47 AM UTC-7, prashant joshi wrote: >>>>> >>>>> how to create pdf report in web2py? i saw video on vimeo but this >>>>> plugin not found.. >>>>> >>>> >>>> >>>> There are multiple ways to do it, but one way (which is briefly >>>> mentioned in the web2py book, and the pieces are in contrib) >>>> is shown at >>>> <URL:https://groups.google.com/d/msg/web2py/fio15y9n2EU/95223fifCgAJ> >>>> >>>> The fpdf link shown in the book appears to be out of date; try >>>> <URL:https://github.com/reingart/pyfpdf/blob/master/docs/Tutorial.md> >>>> (Mariano has additional credits in contrib) >>>> >>>> /dps >>>> >>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "web2py-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to web2py+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.