Export to PDF hangs with larger(?) reports

(7 posts) (3 voices)

Tags:

  1. Gondwana, Member

    First a brief history: I have been developing a series of 30 plus linked reports. The development environment is OSX. The development test environment is OSX.

    All seems to have gone well with respect to wkhtmltopdf. I have followed the threads reporting performance issues. I have not experienced any, except for my largest test report, a 30 page page-view report, seemed to produce a rather large 15.5 MB pdf file. This could take a little time to download from the server.

    We have just configured a Linux QC server. wkhtmltopdf is installed and appears to be working fine. Remarkably, the resulting pdf files are substantially smaller. For example, a 941 kb OSX file was 33 kb on the Linux server. A 285 kb OSX file containing ChartDirector graphics became a 40 kb Linux file. I'm guessing this is a font issue on the OSX systems.

    In my initial testing of the Linux system all reports were running fine. Then I tried exporting to PDF. Everything ran fine except the report that produced the 30 page, 15.5 MB file. It just hung. On the OSX system, it took about two and one half minutes to run, most of the time was spent downloading across the network. Locally it to 15 seconds to run and display the PDF.

    On the Linux system it never did complete. I finally received a 500 Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request.

    This report has no problem with smaller datasets, say a two page report.

    Remember, the problem only appears on a twenty or thirty page report. That amounts to less than 50 rows from the primary table for the 30 page report. A number of tables are joined to bring the report together. It runs quickly when producing HTML.

    So, I edited the report code to turn export debug on. When I ran the problem report, it completed very quickly and gave me the wkhtmltopdf command line to test it out.

    I logged into the Linux server and ran the command line, directing the output to a file. It ran so fast I was sure there was a problem...maybe less than a second. When I opened the resulting PDF, it was fine. The only difference I noticed was formatting of the header timestamp. So I know the HTML is fine and wkhtmltopdf can translate it without a problem. BTW, the Linux PDF file for this particular test is 137 KB as opposed to 13.9 MB OSX file.

    Next I tried the command: ps -ef | grep dbr I was surprised to find a number of processes out there from the last two days:
    /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/local/bin/wkhtmltopdf -q -s LETTER -O Landscape --header-html http://mydomain.com/mydbr/user/export_header_pdf.php --margin-top 13 /tmp/1508430776.html - /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/bin/php /home/mydomain/public_html/mydbr/report.php grep --color dbr /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/local/bin/wkhtmltopdf -q -s LETTER -O Landscape --header-html http://mydomain.com/mydbr/user/export_header_pdf.php --margin-top 13 /tmp/1162373632.html - /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/bin/php /home/mydomain/public_html/mydbr/index.php /usr/bin/php /home/mydomain/public_html/mydbr/index.php /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/local/bin/wkhtmltopdf -q -s LETTER -O Landscape --header-html http://mydomain.com/mydbr/user/export_header_pdf.php --margin-top 13 /tmp/1187638306.html - /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/bin/php /home/mydomain/public_html/mydbr/report.php /usr/local/bin/wkhtmltopdf -q -s LETTER -O Landscape --header-html http://mydomain.com/mydbr/user/export_header_pdf.php --margin-top 13 /tmp/2003766335.html -

    So there appears to be some issue with the myDBR interface to wkhtmltopdf that I don't know how to chase down.

    This problem is on myDBR 3.6.0 (build 1691). I just updated to myDBR 3.6.0 (build 1694) and can confirm this is still an issue.

    Can anyone suggest a course of action to track this down and correct it?

  2. Gondwana, Member

    Perhaps one additional note: When I kill -9 the child wkhtmltopdf process, the parent report.php does terminate.

  3. Gondwana, Member

    A little more additional information: I have no problems with a 4 or 6 page report. However with a 15 page report, I finally received a seemingly useless error message: There was an error (code:6) producing the pdf document
    Failed command: /usr/local/bin/wkhtmltopdf -q -s LETTER -O Landscape --header-html http://mydomain.com/mydbr/user/export_header_pdf.php --margin-top 13 /tmp/1320448259.html -

    Again, from the command line wkhtmltopdf was able to generate the PDF.

  4. Gondwana, Member

    Well, I seem to have found a solution. In short, the latest is not always the greatest. I had been using version 0.11 of wkhtmltopdf. I decided to try version 0.9.9 and it worked! I may have a few font related field sizing issues to sort out. If so, that's trivial.

    I hope you enjoyed this little saga. Better yet, I hope it saves you a few hours of frustration.

  5. myDBR Team, Key Master

    While being an excellent tool, wkhtmltopdf has issues of it's own. For Linux the 0.9.9 version seems sometimes perform better.

    We've submitted a working copy (64bit) of the OS X version to maintainers of wkhtmltopdf as the current version is 32bit and has troubles invoking the GUI when started under 64bit PHP.

    --
    myDBR Team

  6. sallybrown, Member

    We've submitted a working copy (64bit) of the OS X version to maintainers of wkhtmltopdf as the current version is 32bit and has troubles invoking the GUI when started under 64bit PHP.

    Is this available to download for Windows Server 2008?

  7. myDBR Team, Key Master

    You should be able to download the Windows version directly from http://code.google.com/p/wkhtmltopdf/

    --
    myDBR Team


Reply

You must log in to post.