[web2py] Re: Export result set to PDF file

2011-05-19 Thread Neveen Adel
Thanks a lot Anthony  :)

On May 18, 7:15 pm, Anthony  wrote:
> I haven't tried it, bu there's a 'generic.pdf' view template. Looks like it
> takes the HTML inside the 'content' div of a rendered HTML template and
> converts it to markmin and then to PDF. So, maybe try:
>
> def export_PDF():
>     results=db().select()
>     return dict(results=results)
>
> Then define an 'export_PDF.html' view to render the results in HTML, and
> when you go to /app/controller/export_PDF.pdf, the generic PDF view should
> convert the HTML view into a PDF. I think your HTML view will either have to
> extend the default 'layout.html', or make sure the results go inside a div
> with id=content for generic.pdf to work -- otherwise, you could create your
> own custom export_PDF.pdf view based on generic.pdf.
>
> You could also tryhttp://code.google.com/p/pyfpdf/wiki/Web2Py(pyfpdf is a
> contributed module that comes with web2py) 
> orhttps://github.com/lucasdavila/plugin-appreport/wiki.
>
> Anthony
>
> On Wednesday, May 18, 2011 11:40:34 AM UTC-4, Neveen Adel wrote:
> > Hello,
>
> >  How can i export  a result set to PDF file?
>
> > e.g.:
>
> > def export_PDF()
> >       results = db().select()
> >       return pdf_file
>
> > Thanks in Advance


[web2py] Re: Export result set to PDF file

2011-05-18 Thread Anthony
I haven't tried it, bu there's a 'generic.pdf' view template. Looks like it 
takes the HTML inside the 'content' div of a rendered HTML template and 
converts it to markmin and then to PDF. So, maybe try:
 
def export_PDF():
results=db().select()
return dict(results=results)
 
 
Then define an 'export_PDF.html' view to render the results in HTML, and 
when you go to /app/controller/export_PDF.pdf, the generic PDF view should 
convert the HTML view into a PDF. I think your HTML view will either have to 
extend the default 'layout.html', or make sure the results go inside a div 
with id=content for generic.pdf to work -- otherwise, you could create your 
own custom export_PDF.pdf view based on generic.pdf.
 
You could also try http://code.google.com/p/pyfpdf/wiki/Web2Py (pyfpdf is a 
contributed module that comes with web2py) or 
https://github.com/lucasdavila/plugin-appreport/wiki.
 
Anthony
 

On Wednesday, May 18, 2011 11:40:34 AM UTC-4, Neveen Adel wrote:

> Hello, 
>
>  How can i export  a result set to PDF file? 
>
> e.g.: 
>
> def export_PDF() 
>   results = db().select() 
>   return pdf_file 
>
>
>
> Thanks in Advance 
>
>
>