CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Contribution Detail Report - DOMPDF Failure - render() -
Pages: [1]

Author Topic: Contribution Detail Report - DOMPDF Failure - render() -  (Read 2288 times)

royablankenship

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.2
  • MySQL version: 5.5
  • PHP version: 5.4.4
Contribution Detail Report - DOMPDF Failure - render() -
March 01, 2013, 07:58:59 am
Module failing: \htdocs\drupal\sites\all\modules\civicrm\CRM\Utils\PDF\Utils.php

Code starting at line 108:

-------------------------------------------------

  static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
    require_once 'packages/dompdf/dompdf_config.inc.php';
    spl_autoload_register('DOMPDF_autoload');
    $dompdf = new DOMPDF();
    $dompdf->set_paper($paper_size, $orientation);
    $dompdf->load_html($html);
   
//Debug   

echo $html; exit;

ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);
ini_set('max_input_time', 0);

$dompdf->render();

echo 'Here 400!!'; echo $html; exit;

-----------------------------------------------------

With the exit in place, the report shows up on the screen as expected.

When I remove the exit statement, the code fails in the render() code ... ie, I never see the output from echo 'Here 400!!'

Help would be appreciated

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 01, 2013, 08:19:20 am

dompdf most likely is running out of memory int the render function due to the large size of the html

you might want to try using wkhtmltopdf which is a lot more scalable, faster and memory efficient (its also a binary rather than php)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

royablankenship

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.2
  • MySQL version: 5.5
  • PHP version: 5.4.4
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 02, 2013, 12:00:14 pm
Can you point me in the direction concerning how to make this configuration change?
I don't mind researching it, just if I can get in the right direction ...
Thanks,
Roy

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 02, 2013, 12:05:03 pm

check here:

http://drupal.demo.civicrm.org/civicrm/admin/setting/misc?reset=1

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

royablankenship

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.2
  • MySQL version: 5.5
  • PHP version: 5.4.4
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 02, 2013, 03:17:36 pm
Thanks

royablankenship

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.2
  • MySQL version: 5.5
  • PHP version: 5.4.4
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 03, 2013, 01:26:20 pm
Thanks for the help.
I thought I'd pass along this last obstacle I encountered ... since I'm not familiar with the development/issues tracking/etc. platforms, I thought I'd share it here ...

In this modeule: //Hqinternal01\e$\Apache24\htdocs\drupal\sites\all\modules\civicrm\packages\snappy\src\Knp\Snappy\AbstractGenerator.php
   
 protected function executeCommand($command)
    {   
        $stdout = $stderr = $status = null;
        $descriptorspec = array(
           1 => array('pipe', 'w'),  // stdout is a pipe that the child will write to
           2 => array('pipe', 'a') // stderr is a pipe that the child will write to     //<----------------- Line 391 changed from 'w' to 'a'
        );

was hanging in the stream_get_contents code just below this.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 04, 2013, 06:56:39 am

can u check if there is an update to that package in github? we are using a 3rd prty integration package for wkhtmltopdf

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

royablankenship

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7.2
  • MySQL version: 5.5
  • PHP version: 5.4.4
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 04, 2013, 03:02:15 pm
Yes, it appears there is a newer version of the Snappy code on Github.  It doesn't use the pipe method.

I have another question if you don't mind - it's the same report I you helped me with earlier. The PDF version is working well. I'm grateful for you help on that.

When I do the print function, the complete report only prints if I chose legal sized paper, portrait mode with 70% fit to page. Other settings cause it to print, but anywhere from 1/2 to 2/3 of the rows don't end up in the printed report.

I commented out the window.print dialog initiator in the .tpl - so I could view the page source - doesn't have any css reference (@import, <style>, or <link> statements related to css).

On the wkhtmltopdf generated output, it looks perfect.

Any ideas?

Thanks,
Roy

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Contribution Detail Report - DOMPDF Failure - render() -
March 04, 2013, 04:56:02 pm
Quote from: royablankenship on March 04, 2013, 03:02:15 pm
Yes, it appears there is a newer version of the Snappy code on Github.  It doesn't use the pipe method.

can you take a look and update your local site and if it does work, please create an issue and file a patch with the changes to the newer version. Or you can send us a pull request with a jira created issue number

r u talking about this page:

http://sandbox.drupal.civicrm.org/civicrm/report/instance/21?snippet=2 (u'll need to login)

If i do a view source, i do see an import of print.css

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Contribution Detail Report - DOMPDF Failure - render() -

This forum was archived on 2017-11-26.