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 »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • DOMPDF Eating up CPU
Pages: 1 [2] 3

Author Topic: DOMPDF Eating up CPU  (Read 15370 times)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DOMPDF Eating up CPU
May 19, 2011, 10:46:16 am
No solution just yet. I did not try to upgrade as this site is not ready for that.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

gmarsh

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.5.32
  • PHP version: 5.3.26
Re: DOMPDF Eating up CPU
June 07, 2011, 08:32:25 am
Am having a similar problem in Joomla 1.6 / Civi 4.0.1 - a large membership application form stalls in processing and eventually a "500 Server Error" is returned.  I saw this thread, turned off receipting for the contribution page, and everything now processes smoothly.  Smaller forms were never a problem!

Until the PDF processing is made less memory intensive, I would love an option to turn off just the PDF output of the receipt on a page-by-page basis.

I'm assuming that the 4.0.2 upgrade doesn't have any of these changes?

Gary Marsh

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: DOMPDF Eating up CPU
June 07, 2011, 09:37:50 am
Quote from: gmarsh on June 07, 2011, 08:32:25 am
Until the PDF processing is made less memory intensive, I would love an option to turn off just the PDF output of the receipt on a page-by-page basis.

I think having this option would be great and is definitely needed. Any chance you can work on this and contribute a patch to do the same, since you do have a current issue

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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: DOMPDF Eating up CPU
June 07, 2011, 03:10:24 pm
I do note that the dompdf package in CiviCRM seems to be alot older than the one now available for download - you might want to try dropping that into your install & see if it helps
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: DOMPDF Eating up CPU
June 21, 2011, 08:49:56 am
Hi,

We've encountered this problem here and a couple of my colleagues did some investigation. They concluded that it's due to a bug in dompdf, occurring when a page break occurs inside an HTML tag.

They also felt that creating the PDF by converting the entire HTML email to PDF was not the best way of doing things and that it would be preferable and more efficient to have a separate template for generating the PDF.

Related forum posts:
Event Registration Timeout http://forum.civicrm.org/index.php?topic=19650.0
can I turn off the PDF receipt for CiviContribution? don't need/crashes server http://forum.civicrm.org/index.php/topic,19624.0.html

Dave J

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: DOMPDF Eating up CPU
June 21, 2011, 01:13:53 pm
Hi,

You might want to look at how we implemented the namebadge. Choosing a layout is choosing a class, the generator calls that with the params (in that case the name of the contact and informations about the participant) and the class decides to do the layout the way it wants and generate the pdf (without any html magic conversion).

I didn't have performance issues even when generating 100th of badges with complex layout.

This idea might work as well for the attachment, could allow to define a "do nothing" class too.
 
X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: DOMPDF Eating up CPU
June 21, 2011, 01:14:28 pm
In 3.4.3 we added a config setting to turn this off globally, check:

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

for the option: Attach PDF copy to receipts

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

andyw

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 4
  • CiviCRM version: 4.x
  • CMS version: Drupal, Joomla
Re: DOMPDF Eating up CPU
June 22, 2011, 04:27:36 am
Hi there,

Further to DaveJ's comments, while investigating this, we also ended up writing some custom code to produce really nice looking invoices / receipts using TCPDF directly, then attach them to the email - partly to get round the domPDF bug, but also because our client was quite particular about the look and layout.

Would be quite happy to donate this and possibly a bit of time if anyone thinks this might be a useful improvement / possibly the way to go, maybe in combination with something like Xavier's system for defining the layout? (which I've not looked at, but sounds very interesting).

Currently though (and leaving the whole domPDF issue aside), I don't think the invoices produced are really up to the standard required by the type of organizations CiviCRM is aimed at, and would be quite keen to help improve this if possible.

Andrew
Andrew Walker, Developer at Circle Interactive

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DOMPDF Eating up CPU
June 22, 2011, 05:01:36 am
We would certainly be interested to see your code. I also wrote a Drupal module once to produce very specific PDF receipts for an install. If you can upload the code or put it on github etc. that would be great.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: DOMPDF Eating up CPU
June 22, 2011, 07:28:34 am
For the badges the parent class is CRM/Event/Badge.php

and you can define as many as you want (right now 4, including one that print upside down) under CRM/Event/Badge/

Something that would be magic would be to be able to let the class define the name & mimetype it wants

I don't care about pdf, but i'd love to hack a VCALENDAR so the participants can directly put in their calendar the event.



-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: DOMPDF Eating up CPU
June 22, 2011, 11:05:28 am
Quote from: AW on June 22, 2011, 04:27:36 am
Would be quite happy to donate this and possibly a bit of time if anyone thinks this might be a useful improvement / possibly the way to go, maybe in combination with something like Xavier's system for defining the layout? (which I've not looked at, but sounds very interesting).

Andrew:

Would be great if you can blog about this and attach some screenshots of what u've done and how you accomplished this. Will give folks a better idea of what we might be able to do, and potentially act as a starting point to integrate some of these changes back into core

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

andyw

  • I post occasionally
  • **
  • Posts: 82
  • Karma: 4
  • CiviCRM version: 4.x
  • CMS version: Drupal, Joomla
Re: DOMPDF Eating up CPU
June 23, 2011, 01:25:31 am
Will do then - if you can give me about a week or so, I'll get the code cleaned up a bit, write about it somewhere and post some examples of the invoices we're producing.

Hopefully it will be of some use, but if not, no problem.

Andrew
Andrew Walker, Developer at Circle Interactive

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: DOMPDF Eating up CPU
June 28, 2011, 07:56:49 pm
Hey AW - will be great to see this code. Not clear if this will be an option for the PDFs used in the System Template Messages but take it that it would. Have been battling with the PDFs and images and tables messing things badly.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: DOMPDF Eating up CPU
June 29, 2011, 05:08:58 am
In my installs, the action "Create PDF Letter" is very memory-intensive, I presume because it is using DOMPDF.     Since I cannot control the layouts the user will want, it seems like using TCPDF is not an option.

Any other thoughts on how I can improve the memory usage of "Create PDF Letter" ?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: DOMPDF Eating up CPU
July 01, 2011, 10:53:37 pm
FYI with 3.4.3 there is now a setting for "PDF receipt" under global settings > miscellaneous - and you can turn it off.

I've found that minimizing HTML in PDF letters means faster response times, so it is a fair assumption that less HTML also means less CPU power consumed.    I try to keep the HTML to a bare minimum, super simplistic:  one table around your text, and then <br> tags and that's it.

« Last Edit: July 01, 2011, 10:56:26 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: 1 [2] 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • DOMPDF Eating up CPU

This forum was archived on 2017-11-26.