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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Weird problems with text when producing PDF letters
Pages: [1]

Author Topic: Weird problems with text when producing PDF letters  (Read 2966 times)

Freya von Moltke-Foundation

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
  • CiviCRM version: civiCRM 4.7.19
  • CMS version: Wordpress 4.8
  • MySQL version: 5.1.73
  • PHP version: 5.6.30
Weird problems with text when producing PDF letters
September 14, 2011, 09:39:44 am
Hello,

we just discovered some very weird problems occuring when creating PDF letters for contacts.
We have a message template that uses HTML for producing a PDF letter running the text in 2 tables - in the left bigger table the main message text and in the right hand table information about or foundation (who is on the foundation board, our address and contact details etc.)

Anyway, what happened now is that while still editing the text on the print pdf letters page in CiviCRM, everything worked out fine, but after producing the PDF document, the text in it changed somehow. For example, there are divider signs within words as if there it was devided on 2 lines even without any need for that. (for example, some words looked like Ge-schenk instead of Geschenk or Mitstreit-er-innen instead of Mitstreiterinnen written together as it has to be).

Furthermore, the cross sign behind the name of Freya von Moltke, who gave our Foundation her name and who passed away last year is transverted into a question mark.

We dont have the faintest idea why this is happening as while still being on civicrm everything is displayed fine, also when looking at the source code.

If anyone has an idea what the problem is here, we would be very thankfull for help!
Greetings from Berlin

Anja and Micha
« Last Edit: September 16, 2011, 04:39:46 am by Freya von Moltke-Foundation »

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Weird problems with text when producing PDF letters
September 14, 2011, 12:00:36 pm
I think this might be related to character encoding. Can you try to replicate this problem on http://drupal7.demo.civicrm.org

Thanks
Kurund
Found this reply helpful? Support CiviCRM

Freya von Moltke-Foundation

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
  • CiviCRM version: civiCRM 4.7.19
  • CMS version: Wordpress 4.8
  • MySQL version: 5.1.73
  • PHP version: 5.6.30
Re: Weird problems with text when producing PDF letters
September 15, 2011, 01:14:53 am
Hey,

ok so I just tried it on the demo version. Weirdly a part of the problem i described above doesnt occur, like the cross is not transverted into a question mark. However, still some of the words (the words where it occured before as well) are still splitted, like Mit-streit-er-innen instead of Mitstreiterinnen etc.

By the way I tried just using another writing, but the problem did occur with Times new roman and comic sans as well as with garamond, which is our default.


Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Weird problems with text when producing PDF letters
September 15, 2011, 02:27:41 am
Quote
By the way I tried just using another writing, but the problem did occur with Times new roman and comic sans as well as with garamond, which is our default.
It might be possible that these fonts don't support UTF8 characters, hence it displays it incorrectly.

Kurund
Found this reply helpful? Support CiviCRM

Freya von Moltke-Foundation

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
  • CiviCRM version: civiCRM 4.7.19
  • CMS version: Wordpress 4.8
  • MySQL version: 5.1.73
  • PHP version: 5.6.30
Re: Weird problems with text when producing PDF letters
September 15, 2011, 04:36:31 am
Mmm, yeah, but why are those characters displayed incorrectly only in the  produced PDF file? As I said, on the print pdf page the text appears fine and only changes when converted into PDF.

Anyway, thank you for your reply!

Anja

Freya von Moltke-Foundation

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
  • CiviCRM version: civiCRM 4.7.19
  • CMS version: Wordpress 4.8
  • MySQL version: 5.1.73
  • PHP version: 5.6.30
Re: Weird problems with text when producing PDF letters
September 16, 2011, 03:53:11 am
It turned out to be a problem of CKEditor's configuration.

When inserting text from MS Word the editor kept all special characters (umlauts, symbols, hidden characters(!!!)) at their original encoding. When converting the HTML to pdf, the converter (dompdf) seems not to understand all of these (utf8-encoded?) characters and messes up the resulting text. E.g. it doesn't understand the long dash or the cross and replaces them with a question mark and it replaces the conditional hyphen ­ with a permanent hyphen and because that lines become longer and break within words.

The reason for that is the configuration of CKEditor which is found in the file config.js in the directory of CKEditor's package. After installing it with civiCRM is defaults to not to replace special characters with their respective HTML-entities config.entities = false;.

The solution is to set this to config.entities = true; (which btw is the "factory"-default of CKEditor). After that all special characters became HTML-entities or were kept as such. The conditional hyphens after that were seen first time :o
dompdf handles these characters now as expected.

One question remains: Is there a reason why config.entities by default is set to 'false'?


Edit:
To answer the question: Yes, there is a reason. It's been actually named in the comment (I've deleted). Smarty needs e.g. quotes to recognize its commands. It will not work with entities.

I'm now trying to convince CKEditor to leave the characters needed by Smarty untouched. But that turns out easier to be said than done since it seems to ignore any "advanced" configuration.
« Last Edit: September 16, 2011, 06:58:26 am by Freya von Moltke-Foundation »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Weird problems with text when producing PDF letters

This forum was archived on 2017-11-26.