Friday, April 29, 2011

Problem with HTML_ToPDF class (PHP)


In my project, I'm using HTML_ToPDF PHP class, which uses html2ps script to convert from HTML to PDF file.

Recently I upgrated my production server to Debian 5 (lenny) and, after that, HTML_ToPDF is no longer working:

convert() method from HTML_ToPDF class is returning this error:

Error: there was a problem running the html2ps command.  Error code returned: 127.  setDebug() for more information.

And, the output from html2ps call is:

/usr/bin/perl: symbol lookup error: /usr/lib/perl5/auto/Compress/Zlib/ undefined symbol: Perl_Tstack_sp_ptr

Any help would be appreciated, thanks!

[Edited] After some tests, I've found that the problem happens only with HTML containing images ( tags). When html2ps founds the first image it crashes. Converting HTML without images works fine. Any idea? Thanks!

From stackoverflow
  • This is an issue with the initial conversion from HTML to PS. Usually due to poorly written HTML.

    Can you show some examples of what you are trying to convert?

  • To be honest I've found wkhtmltopdf to be far better than html2ps, even though it's at a fairly early stage of development.

    I wrote a blog about it, but if you don't want to read that basically it uses KHTML/Webkit's rendering engine to render the page which is a bit more sensible than the usual approach of writing a complete HTML renderer.

    The distributed binary worked just fine on my Debian server, and frankly the results are excellent.

    Ciaran McNulty : It is a worry, but it's only a 'temporary' X-server and isn't using a huge framebuffer - I'd have to do some profiling vs. html2ps before I assumed it was more impact. Thanks for the click though!
  • Try this

    apt-get install perl=5.8.8-7etch6 perl-base=5.8.8-7etch6 perl-modules=5.8.8-7etch6 debconf-i18n=1.5.11etch2 liblocale-gettext-perl=1.05-1 libtext-iconv-perl=1.4-3 libtext-wrapi18n-perl=0.06-5 libtext-charwidth-perl=0.04-4 html2ps=1.0b5-2 libapache2-mod-perl2=2.0.2-2.4 libcompress-zlib-perl=1.42-2 libfuse-perl=0.07-2+b2 libhtml-parser-perl=3.55-1 libhtml-tree-perl=3.19.01-2 libio-zlib-perl=1.04-1 libwww-perl=5.805-1 perlmagick=7: snmpd=5.2.3-7etch4 xhtml2ps mysql-client=5.0.32-7etch8 mysql-client-5.0=5.0.32-7etch8 libdbd-mysql-perl=3.0008-1 libdbi-perl=1.53-1etch1


Post a Comment