Re: [xhtml2pdf] Digest for xhtml2pdf@googlegroups.com - 3 Messages in 2 Topics

73 views
Skip to first unread message

Martin Weissenboeck

unread,
May 3, 2013, 3:07:20 PM5/3/13
to xhtm...@googlegroups.com
Now I have tried weasyprint - it is very slow.

def we():
    import weasyprint
    html= HTML(
            HEAD(
                STYLE("""table, th, td {
                    border: 1px solid #040;
                    border-collapse: collapse;
                    font-family: Verdana;
                    font-size: 1em;
                    text-align: center;
                    padding: 5px;
                    }""" ,  _type="text/css"),
                ),
            BODY(TABLE(*[TR(j, *[i for i in range(15)]) for j in range(60)])
          ))
    s=str(html)
    print s
    doc = weasyprint.HTML(string=s.encode('utf-8'))
    d=doc.render()
    p=d.write_pdf()
   
    response.headers['Content-Type'] = "application/pdf"
    return p
   

A table with 15 * 60 field and the pdf file needs 2 min 40 sec to create.

Regards, Martin



2013/5/3 <xhtm...@googlegroups.com>

Group: http://groups.google.com/group/xhtml2pdf/topics

    Ed Bright <p...@intex.com> May 02 08:39AM -0700  

    Hi,
    When I used xhtml2pdf module to save a html source page into a temporary
    directory on my window 7 machine, I got an error:
    [Errno 13] Permission denied: 'd:\\\\temp\\\\file_download
     
    The folder is a temporary folder on my machine and I can write/read without
    issue in a dos command window. Has anyone seen similar problem or did I
    miss anything?
    Here is a snippet of the code:
     
     
    from selenium import webdriver
    import cStringIO
    import xhtml2pdf.pisa as pisa
    ...
    driver = webdriver.Firefox(firefox_profile=profile)
    ....
    data = driver.page_source
    pdf = pisa.CreatePDF(cStringIO.StringIO(data),file(save_path, "wb"))
     
     
    The error trapped was:
    [Errno 13] Permission denied: 'd:\\\\temp\\\\file_download
     
    Thanks in advance for any help.

     

    "Michał Gajek" <mig...@gmail.com> May 02 05:03AM -0700  

    Hi,
    I've solved the problem by moving to weasyprint ( http://weasyprint.org/ ).
    it has pretty proper support of CSS properties, but first of all it just
    WORKS.
     
    Best regards,
    Michal Gajek
     
    On Tuesday, April 30, 2013 5:35:09 PM UTC+2, Daniel Pelegrini wrote:

     

    Dirk Holtwick <dirk.h...@gmail.com> May 02 02:40PM +0200  

    Hi Michael,
     
    Thanks for sharing, this project looks awesome! I have updated the "Alternatives" section accordingly: http://www.xhtml2pdf.com/
     
    You need to consider, that xhtml2pdf development has been started almost 10 years ago and that most HTML and CSS features didn't even exist at that time. Also the availability of third party libraries that help parsing HTML and creating PDF has become much better nowadays.
     
    But xhtml2pdf has also proved to work reliable in production environments and porting is easy since it is written in pure Python and hasn't very much dependencies.
     
    Anyway it's great to see that there are other Python projects that work on HTML to PDF conversion. I still believe in the basic idea of leveraging common HTML knowledge to create flexible PDF output. Those two worlds deserve a good links in form of a good tools :)
     
    Cheers,
    Dirk
     

     

You received this message because you are subscribed to the Google Group xhtml2pdf.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
You received this message because you are subscribed to the Google Groups "Pisa XHTML2PDF Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xhtml2pdf+...@googlegroups.com.
To post to this group, send email to xhtm...@googlegroups.com.
Visit this group at http://groups.google.com/group/xhtml2pdf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Reply all
Reply to author
Forward
0 new messages