Thanks Mariano and Carlos, there is a simple code:

controller default.py:

def pdf_test:
    return dict(hello="hello")

view default/pdf_test.html:

<body>
    <h1>{{=hello}}</h1>
    <p>This is a text</p>
    <table width="100%">
        <thead>
            <tr>
                <th width="40%">name</th>
                <th width="60%">lastame</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td width="40%">pepe</td>
                <td width="60%">paco</td>
            </tr>
        </tbody>
    </table>
</body>


"http://localhost:8000/myapp/default/pdf_test.pdf"; shows a "Table column/cell width not specified, unable to continue" error. and removing the table, return a blank pdf


El 21/05/14 11:33, Mariano Reingart escribió:
Yes, pyfpdf has a basic html parser (based on python stdlib) and needs some conventions to translate tables to PDF.

Could you make a minimal example to test and debug it?
That way it would be easy to reproduce and see how to adapt the html to be rendered.

You can look at the documented examples, using <thead> and <th> tags will help, and you need to specify the total table and cell widths:

https://code.google.com/p/pyfpdf/wiki/WriteHTML

Best regards,


Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, May 21, 2014 at 12:26 PM, Carlos Costa <yamandu.co...@gmail.com <mailto:yamandu.co...@gmail.com>> wrote:

    It uses pyfpdf to convert it.
    But there are some restrictions as I remember.
    You check it here https://code.google.com/p/pyfpdf/


    2014-05-21 12:13 GMT-03:00 Carlos Cesar Caballero Díaz
    <desarro...@spicm.cfg.sld.cu <mailto:desarro...@spicm.cfg.sld.cu>>:

        Hi, I need some help, when I call a view with ".pdf" this:

        <html>
            <head>
                <title>Report</title>
            </head>
            <body>
                <table>
                    <tr>
                        <td width="50%">name</td>
                        <td width="50%">pepe</td>
                    </tr>
                </table>
            </body>
        </html>

        or this:

        <body>
            <table>
                <tr>
                    <td width="50%">name</td>
                    <td width="50%">pepe</td>
                </tr>
            </table>
        </body>

        returns a blank one page pdf. Now if I put the content before
        the body tag, it is rendered, but the table allways throw a
        "Table column/cell width not specified, unable to continue" error.
-- 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
        <mailto:web2py+unsubscr...@googlegroups.com>.
        For more options, visit https://groups.google.com/d/optout.




-- Att.

    Carlos J. Costa
    Cientista da Computação
    Esp. Gestão em Telecom

    EL MELECH NEEMAN!
    אָמֵן

-- 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
    <mailto:web2py+unsubscr...@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+unsubscr...@googlegroups.com <mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.



--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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.

Reply via email to