Generating PDF results in single page only?

Posted by A T on Stack Overflow See other posts from Stack Overflow or by A T
Published on 2014-05-27T03:22:35Z Indexed on 2014/05/27 3:24 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

Generating a PDF from an email (Zurb Ink templated); but am always presented with a single page PDF.

Runnable test-case:

from weasyprint import HTML, CSS
from urllib2 import urlopen

if __name__ == '__main__':
    html = urlopen('http://zurb.com/ink/downloads/templates/basic.html').read()
    html = html.replace('<p class=\"lead\">', '{0}<p class=\"lead\">'.format(
        '<p class=\"lead\">{0}</p>'.format("foobar " * 50) * 50))
    HTML(string=html).write_pdf('foo.pdf', stylesheets=[
                                  CSS(string='@page { size: A4; margin: 2cm };'
                                             '* { float: none !important; };'
                                             '@media print { nav { display: none; } }')
                                ])

How do I get a multi-page PDF?

© Stack Overflow or respective owner

Related posts about css

Related posts about pdf