Project

General

Profile

Actions

Defect #61

closed

Broken character encoding in pdf export

Added by Nikolay Solakov over 17 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Assignee:
Toshi MARUYAMA
Category:
PDF export
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Hi,
There is a thread in the open discussion:
http://rubyforge.org/forum/forum.php?thread_id=13593&forum_id=7504
I attached the exported pdf and screenshot.


Files

export.pdf (2.24 KB) export.pdf Nikolay Solakov, 2008-02-03 10:50
issues.jpg (128 KB) issues.jpg Nikolay Solakov, 2008-02-03 10:50
bulg.pdf (308 KB) bulg.pdf Jan Topiński, 2008-11-16 15:02
61.patch (2.48 KB) 61.patch Jan Topiński, 2008-11-16 15:02
redmine-2022_fr.pdf (308 KB) redmine-2022_fr.pdf Jean-Philippe Lang, 2008-11-18 18:32
redmine-2022_bg.pdf (308 KB) redmine-2022_bg.pdf Jean-Philippe Lang, 2008-11-18 18:32
redmine-sc-15850.pdf (315 KB) redmine-sc-15850.pdf Ernad Husremovic, 2008-11-18 20:13
praw-pl-fr.pdf (376 KB) praw-pl-fr.pdf Jan Topiński, 2008-11-23 01:48
praw-jp.png (58.1 KB) praw-jp.png Jan Topiński, 2008-11-23 01:52
prawn.patch (4 KB) prawn.patch Jan Topiński, 2008-11-25 23:50
prawn.patch (4.05 KB) prawn.patch Heejong Lee, 2008-11-27 10:53
export-4.png (24.2 KB) export-4.png Alexey Kornilov, 2009-03-11 14:55
rfpdf-korean.diff (1.51 KB) rfpdf-korean.diff Gyoung-Yoon Noh, 2009-05-21 04:17
pdf-0.8.4.patch (2.04 KB) pdf-0.8.4.patch Konstantin Ershov, 2009-06-02 13:54
prawn.patch (3.97 KB) prawn.patch chaninan jitonnom, 2009-11-24 03:49
61.patch (1.89 KB) 61.patch Aleksander Palyan, 2010-09-01 16:43
61-enhanced.patch (3.1 KB) 61-enhanced.patch Enhanced patch over Aleksander Palyan's Sin-young Kang, 2010-09-26 16:32
arabic_PDF.png (103 KB) arabic_PDF.png Ahmed Skaik, 2010-10-18 18:27
61-1.1.patch (1.58 KB) 61-1.1.patch Yuriy Vidineev, 2011-01-27 11:25
korean.rb_rfpdf115.patch (2.32 KB) korean.rb_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
pdf.rb_rfpdf115.patch (13.1 KB) pdf.rb_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
gantt.rb_rfpdf115.patch (5.38 KB) gantt.rb_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
locales_rfpdf115.patch (10.1 KB) locales_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
chinese.rb_rfpdf115.patch (4.67 KB) chinese.rb_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
japanese.rb_rfpdf115.patch (2.02 KB) japanese.rb_rfpdf115.patch Jun NAITOH, 2011-03-27 09:34
gantt.rb_rfpdf115_2.patch (5.64 KB) gantt.rb_rfpdf115_2.patch Jun NAITOH, 2011-03-29 16:08
pdf.rb_rfpdf115_2.patch (12.7 KB) pdf.rb_rfpdf115_2.patch Jun NAITOH, 2011-03-29 16:08
gantt.rb (31.8 KB) gantt.rb Jun NAITOH, 2011-03-29 16:08
pdf.rb (12.7 KB) pdf.rb Jun NAITOH, 2011-03-29 16:08
tcpdf_binary.patch (2.1 KB) tcpdf_binary.patch for trunk patch Jun NAITOH, 2011-04-02 05:46
r5258_chinese.rb.patch (800 Bytes) r5258_chinese.rb.patch Jun NAITOH, 2011-04-02 09:09
chinese_trunk.pdf (5.23 KB) chinese_trunk.pdf Jun NAITOH, 2011-04-02 09:09
chinese_trunk_patched.pdf (5.23 KB) chinese_trunk_patched.pdf Jun NAITOH, 2011-04-02 09:09
pdf_ruby19.patch (2.71 KB) pdf_ruby19.patch Jun NAITOH, 2011-04-04 00:47
pdf_ruby19.patch2 (2.43 KB) pdf_ruby19.patch2 Jun NAITOH, 2011-04-04 16:20
pdf.rb_illegal_character.patch (988 Bytes) pdf.rb_illegal_character.patch Jun NAITOH, 2011-04-06 01:08
20110408-01.png (66.7 KB) 20110408-01.png staccatissimo Lee, 2011-04-08 10:07
issue-list.png (17.8 KB) issue-list.png Toshi MARUYAMA, 2011-04-08 11:23
freesans-font.png (39.5 KB) freesans-font.png Toshi MARUYAMA, 2011-04-08 11:23
english.pdf (307 KB) english.pdf Toshi MARUYAMA, 2011-04-08 11:23
Simplified-Chinese.pdf (5.25 KB) Simplified-Chinese.pdf Toshi MARUYAMA, 2011-04-08 11:23
20110408-02.png (83.4 KB) 20110408-02.png staccatissimo Lee, 2011-04-08 11:48
pdf_encoding.patch (2.96 KB) pdf_encoding.patch Jun NAITOH, 2011-04-10 01:52
locales_encoding.patch (9.7 KB) locales_encoding.patch Jun NAITOH, 2011-04-10 01:52
encoding.png (27.4 KB) encoding.png Jun NAITOH, 2011-04-10 01:52
pdf_0x5c_char_handling.patch (1.93 KB) pdf_0x5c_char_handling.patch Jun NAITOH, 2011-04-29 00:07

Related issues

Related to Redmine - Feature #3794: UTF in issue generated reportClosed2009-08-29

Actions
Related to Redmine - Defect #4375: how to export PDF in Thai using Redmine 0.8.7Closed2009-12-10

Actions
Related to Redmine - Defect #4708: export to PDF do not work correctly with Czech languageClosed2010-02-01

Actions
Related to Redmine - Defect #7287: PDF Export Turkish characters not showingClosed2011-01-11

Actions
Related to Redmine - Defect #7794: Internal server error on formatting an issue as a PDF in JapaneseClosedToshi MARUYAMA2011-03-06

Actions
Related to Redmine - Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) characters appear as ?ClosedToshi MARUYAMA2010-02-10

Actions
Related to Redmine - Defect #9: Export feature(to csv/pdf) doesn't work (in Japanese)Closed

Actions
Related to Redmine - Defect #7373: Error with PDF output and ruby 1.9.2Closed2011-01-19

Actions
Related to Redmine - Patch #5629: Wrap text fields properly in PDF ClosedToshi MARUYAMA2010-06-01

Actions
Related to Redmine - Patch #8312: Switch to TCPDF from FPDF for PDF exportClosedToshi MARUYAMA2011-05-06

Actions
Related to Redmine - Defect #5024: Internal error after clicking on link to PDF ExportClosedToshi MARUYAMA2010-03-10

Actions
Related to Redmine - Defect #8565: JRuby: Japanese PDF export errorClosedToshi MARUYAMA2011-06-08

Actions
Related to Redmine - Defect #8566: Exported PDF UTF-8 Vietnamese not correctClosedToshi MARUYAMA2011-06-08

Actions
Related to Redmine - Feature #69: Textilized description in PDFClosedToshi MARUYAMA

Actions
Related to Redmine - Defect #11927: Vietnamese Unicode charater broken when exporting to PDFClosed

Actions
Is duplicate of Redmine - Defect #76: PDF fonts must be in UTF-8Closed

Actions
Has duplicate Redmine - Defect #856: Export issue to PDF - broken character encodingClosed2008-03-14

Actions
Has duplicate Redmine - Defect #3092: Wrong encoding in Gantt / PDF exportClosed2009-04-01

Actions
Has duplicate Redmine - Defect #3894: Wrong encoding in PDF export with KoreanClosed2009-09-20

Actions
Has duplicate Redmine - Feature #4012: Out Of The Box full PDF internationalizationClosed2009-10-09

Actions
Has duplicate Redmine - Defect #4220: Export to PDF in thai language it doesn't workClosedJean-Philippe Lang2009-11-15

Actions
Has duplicate Redmine - Defect #5064: Garbled or unsupported characters in PDF output (utf-8)Closed2010-03-12

Actions
Has duplicate Redmine - Defect #6999: Export PDF is broken for Mongolian languageClosedEric Davis2010-11-292010-12-05

Actions
Has duplicate Redmine - Feature #4699: Export PDF in Chinese and Japanese language is get well in redmine 0.8.7Closed2010-01-31

Actions
Has duplicate Redmine - Defect #5884: PDF export doesn't work for HebrewClosed2010-07-15

Actions
Has duplicate Redmine - Defect #6505: PDF export broken with Japanese (Gannt and Issue Tracking)Closed2010-09-27

Actions
Has duplicate Redmine - Defect #7019: Issue pdf export Closed2010-12-02

Actions
Has duplicate Redmine - Defect #7833: pdf export problemClosed2011-03-11

Actions
Has duplicate Redmine - Defect #6506: Gantt chart export to PDF/PNG works incorrectly in zh-tw localeClosed2010-09-27

Actions
Has duplicate Redmine - Defect #7461: Special chars / umlauts broken in CSV / PDF exportClosed

Actions
Has duplicate Redmine - Defect #8455: Cyrillic output in PDFClosed2011-05-28

Actions
Actions #1

Updated by Nikolay Solakov over 17 years ago

I forgot... this is in my bg.yml lang file:
general_csv_encoding: windows-1251
general_pdf_encoding: windows-1251

Thanks,
Nikolay

Actions #2

Updated by Jean-Philippe Lang over 17 years ago

Since, rfpdf is a ruby port of fpdf, I've tried to add bulgarian
support following this tutorial:
http://www.fpdf.de/tutorials/7/
... with no result. I only get squares instead of cyrillic
characters.

Actions #3

Updated by Nikolay Solakov about 17 years ago

Can anyone solve this old puzzle?

Thanks,
Nikolay

Actions #4

Updated by David Fugere almost 17 years ago

have you found an answer?

Actions #5

Updated by Michael Pirogov almost 17 years ago

They says that (http://dry.4thebusiness.com/?document=3) they've
unicode support. Check out test_unicode link and see, that russian
and all other non-latin stuff is just fine.

Actions #6

Updated by Jan Topiński about 16 years ago

I think I've fixed that one. See bulg.pdf.

To fix it one needs to

  1. Update rfpdf to the newest version:
    script/plugin install git://github.com/edwinmoss/rfpdf.git --force
  2. Apply attached patch:
    patch -p0 < 61.patch

Pdf export worked fine for me (Polish) and for Bulgarian.

Actions #7

Updated by Paul Rivier about 16 years ago

  • Assignee set to Jean-Philippe Lang

Hello Jan,

thank you for this patch.

Can anybody with different locales try and confirm that UTF8 export now works well.
Jean-Philippe, any position on the current status of the pdf exporter in redmine ? I see 0.8 is planed for 7 weeks from now, do you think we can integrate the updated version of rfpdf and Jan's patch before feature-freeze ?

Actions #8

Updated by Jean-Philippe Lang about 16 years ago

I'd really like to fix it but it doesn't work for me.
Jan, after following the above instructions, pdf are broken (see attached french and bulgarian pdf). Any idea?

Paul, does the patch work for you?

Actions #9

Updated by Ernad Husremovic about 16 years ago

I can confirm that bosnian characters works well.

general_pdf_encoding: utf8

after rfpdf upgrade, pdf size is 314 KB (attached), before upgrade it was 2.5 KB. Obviously utf font is embedded into the pdf.

Actions #10

Updated by David Strejc about 16 years ago

I can confirm that this patch works for Czech language.

Actions #11

Updated by Sergej Jegorov about 16 years ago

I confirm, that patch works for Lithuanian language.

Actions #12

Updated by Azamat Hackimov about 16 years ago

Works fine for Russian. Tested for gannt and task. Is possible reduse filesize of generated PDF?

Actions #13

Updated by Jean-Philippe Lang about 16 years ago

French works with "vera" font.
A error is raised for japanese, traditional chinese and simplified chinese.

Actions #14

Updated by Jan Topiński about 16 years ago

I tried to fix Japanese and Chinese but I can't. I'm afraid that it's time to switch redmine to something like prawnto. I can volunteer to do it if you Jean think this is the right path.

Actions #15

Updated by Jan Topiński about 16 years ago

This two pdf files are generated with prawnto version of a issues index view. French-Polish praw-pl-fr.pdf seem ok Japanese is ok but latin fonts look ugly attachment:/praw-jp.pdf.

Actions #16

Updated by Jan Topiński about 16 years ago

I'm sorry Japanese file was too big and did not made to the page so I attach a screen-shot of it praw-jp.png.

Actions #17

Updated by Jean-Philippe Lang about 16 years ago

Jan, these pdf generated with prawnto look good (except the fact that praw-pl-fr.pdf contains the html layout).
If prawnto offers the required functionalities, switching would be a solution. Could you post the patch you used to generate these pdf ?

Actions #18

Updated by Jean-Philippe Lang about 16 years ago

I've made a few tests with prawn. It's much more easy to use than rfpdf but it's much slower. The generation of a list of 100 issues takes about 10s on my box (<1s with rfpdf). I'm afraid that it makes it unusable.

Actions #19

Updated by Jean-Philippe Lang about 16 years ago

Looks like it's faster when using ttf fonts:
  • dejavusans: 3s
  • comicsans: 1.75s
Actions #20

Updated by Eric Davis about 16 years ago

rfpdf is causing my mongrels to die and timeout quite frequently now. It's happening so much that I'm turning off all PDF export on my installation. I'm interested in seeing how prawn performs against rfpdf with my issue data.

Actions #21

Updated by Jan Topiński about 16 years ago

Requested patch is here prawn.patch (for testing only).
To use it one needs to install prawnto:
  1. install prawn:
    gem install prawn
  2. install prawnto:
    script/plugin install git://github.com/thorny-sun/prawnto.git

Jean: the only problem apart of performance can be with gantt, there are some issues with prawn and png in tables. I will try to make the gantt pdf and we will see.

Actions #22

Updated by Heejong Lee about 16 years ago

Your patch causes permission denied error.

ActionView::TemplateError (Permission denied - index.pdf) on line #2 of issues/index.pdf.prawn:
1: Prawn::Document.generate('index.pdf', :page_layout => :landscape) do |pdf|
2: pdf.font(PdfHelper.font_for_lang(current_language))
3: title = @project ? "#{@project.name} - #{l(:label_issue_plural)}" : "#{l(:label_issue_plural)}" 
4: 
5: pdf.header pdf.margin_box.top_left do

Use Document.new instead. Modified patch is attached.

Actions #23

Updated by Jean-Philippe Lang almost 16 years ago

  • Status changed from New to Closed

Dup of #61.

Actions #24

Updated by Jean-Philippe Lang almost 16 years ago

  • Status changed from Closed to New
Actions #25

Updated by Jean-Philippe Lang almost 16 years ago

  • Subject changed from export to pdf to Broken character encoding in pdf export
Actions #26

Updated by Alexey Kornilov almost 16 years ago

We have hust upgraded to 0.8.4 release and the exported pdfs are now broken again. We are using Russian for our projects.
Formerly we have successefully used the 61.patch by Jan Topiński for version 0.8. Now it seems that the architecture has been changed, so the patch does not help anymore.

The screenshot is attached

Actions #27

Updated by Maxim Krušina over 15 years ago

  • Priority changed from Normal to High

Hi there, any rpogress with ths issue?
Should I ask our guys to look on this issue?

Actions #28

Updated by Gyoung-Yoon Noh over 15 years ago

Exporting to PDF breaks Korean characters in trunk. I fixed this, but I am not sure that it is right solution. This fix is dependent on UnDotum font, which is included in unfonts package licensed by GPL.

Actions #29

Updated by Gyoung-Yoon Noh over 15 years ago

Gyoung-Yoon Noh wrote:

Exporting to PDF breaks Korean characters in trunk. I fixed this, but I am not sure that it is right solution. This fix is dependent on UnDotum font, which is included in unfonts package licensed by GPL.

Sorry, it does not depend on unfonts package. It will work on any UHC-inclusive font package.

Actions #30

Updated by Stanislav German-Evtushenko over 15 years ago

I have tried to change output fonts from Helvetica to FreeSans (Helvetica doesn't support Cyrillic). Font have been changed in output PDF but Cyrillic text is still unreadable.

Actions #31

Updated by Szymon Połom over 15 years ago

Can confirm this issue.

My last name is Połom but it gets exported as PoÅ‚om to a PDF.

Actions #32

Updated by Konstantin Ershov over 15 years ago

Also confirm that in Redmine 0.8.4 I have broken PDFs with cyrillic characters.

I have "Задача" instead of "Задача".

Actions #33

Updated by Konstantin Ershov over 15 years ago

Solved for Redmine 0.8.4.

Standart rfpdf was replaced with rfpdf from http://github.com/edwinmoss/rfpdf/zipball/master and then we made some changes mentioned above with lib/redmine/export/pdf.rb.

Patch is atached.

PS Exported PDF's include embedded fonts.

Actions #34

Updated by Subramanian N over 15 years ago

  • Assignee changed from Jean-Philippe Lang to Paul Rivier
  • % Done changed from 0 to 30

Nikolay Solakov wrote:

I forgot... this is in my bg.yml lang file:
general_csv_encoding: windows-1251
general_pdf_encoding: windows-1251

Thanks,
Nikolay

Actions #35

Updated by Sergey Tatarenkov about 15 years ago

I and my friend have tested prawn.patch (http://www.redmine.org/attachments/1185/prawn.patch) (thanks to Jan Topiński and Heejong Lee). Cyrillic and Japanese symbols are displayed correctly. So prawn might be right solution.

Actions #36

Updated by chaninan jitonnom about 15 years ago

  • Assignee deleted (Paul Rivier)

i'm new in Redmine . when i change encoding in lang/th.yml file to

general_csv_encoding: utf8
general_pdf_encoding: utf8

after I follow above . Next i restart server and try to export PDF again on pdf link but it doesn't work

i don't know how to fixed them. Or I forgot or do something wrong. please tell me.

Actions #37

Updated by chaninan jitonnom about 15 years ago

  • % Done changed from 30 to 0
Actions #38

Updated by chaninan jitonnom about 15 years ago

  • Assignee set to Jean-Philippe Lang

Quote: Jan Topiński
I think I've fixed that one. See bulg.pdf.

To fix it one needs to

1. Update rfpdf to the newest version:
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
2. Apply attached patch:
patch -p0 < 61.patch

Pdf export worked fine for me (Polish) and for Bulgarian.
Q: from above in step 2 . Apply attached patch how to operate it , patch -p0 < 61.patch, is it command or what?

Actions #39

Updated by Anonymous about 15 years ago

I've tested similar solution, but it does not work with Chinese and Japanese fonts.

Regards
KP

chaninan jitonnom wrote:

Quote: Jan Topiński
I think I've fixed that one. See bulg.pdf.

To fix it one needs to

1. Update rfpdf to the newest version:
script/plugin install git://github.com/edwinmoss/rfpdf.git --force
2. Apply attached patch:
patch -p0 < 61.patch

Pdf export worked fine for me (Polish) and for Bulgarian.
Q: from above in step 2 . Apply attached patch how to operate it , patch -p0 < 61.patch, is it command or what?

Actions #40

Updated by chaninan jitonnom about 15 years ago

Redmine ver.0.8.4 has code in app/controllers/issues_controller.rb line 70 different from this patch >> http://www.redmine.org/attachments/1181/prawn.patch
in patch 70 : format.pdf { send_data(render(:template => 'issues/index.rfpdf', :layout => false), :type => 'application/pdf', :filename => 'export.pdf') }
in Redmine v0.8.4 70 : format.pdf { send_data(issues_to_pdf(@issues, Herve Harster), :type => 'application/pdf', :filename => 'export.pdf') }

So, i change patch above to attached patch in order to able to apply with Redmine v0.8.4
but it also doesn't work .

Actions #41

Updated by Nikolay Kotlyarov almost 15 years ago

+1 for this issue. Export PDF is broken for Russian language.

Way to reproduce:
Select "My account" on the top of this page and change language to Russian or Bulgarian.
Then just export any issue from this site to PDF.

Actions #42

Updated by K S almost 15 years ago

  • % Done changed from 0 to 100

Instructions for latest RFPDF (TCPDF):

The 61.patch sometimnes doesn't work correctly with redmine 0.8.7 stable.

Users can manually change this file: redmine-0.8.7/lib/redmine/export/pdf.rb and remove/change affested lines (see: http://www.redmine.org/attachments/1150/61.patch).

Propably You need also change this file: vendor/plugins/rfpdf/lib/rfpdf/template_handler/compile_support.rb and disable below lines:

  1. extend ActiveSupport::Memoizable
  2. memoize :ie_request?
  3. memoize :ssl_request?
Actions #43

Updated by K S almost 15 years ago

For polish coding you must change a redmine/lang/pl - pdf and cvs section to UTF-8 characters (not iso, if you use FreeSans font!).

Actions #44

Updated by Jeffrey Jones almost 15 years ago

I am late to the party on this one.

Does anyone have a list of steps that need to be followed to enable Japanese PDF output on 0.8.7-stable? I am looking through the history and it looks like I have to

1. update rfpdf
2. apply the 61.patch
3. Do the steps KS listed in previous post.

Is this correct?

Actions #45

Updated by Jeffrey Jones almost 15 years ago

  • % Done changed from 100 to 70

Ok, so this is how I have managed to get it (half) working on 0.9.1

  1. Update RFPDF with
    script/plugin install git://github.com/edwinmoss/rfpdf.git --force
    
  2. Update redmine-0.8.7/lib/redmine/export/pdf.rb so that it matches http://www.redmine.org/attachments/1150/61.patch (NOTE: The patch changes some view files but these have been removed and all the AliasNBPages changes are also in the pdf.rb file)
  3. Edit vendor/plugins/rfpdf/lib/rfpdf/template_handler/compile_support.rb and comment out the following lines:
    extend ActiveSupport::Memoizable
    memoize :ie_request?
    memoize :ssl_request?
    

Doing this means that I can output PDF files. HOWEVER these files can only display Hiragana and Katakana and cannot display Kanji, so practically useless at the moment.

Actions #46

Updated by Jeffrey Jones almost 15 years ago

Doing this means that I can output PDF files. HOWEVER these files can only display Hiragana and Katakana and cannot display Kanji, so > practically useless at the moment.

Thinking about it, this might be a font issue?

Actions #47

Updated by Kirill Ponomarev almost 15 years ago

Is there any progress in this issue?

Actions #48

Updated by Nikolay Kotlyarov almost 15 years ago

CSV export also broken in russian (Redmine 0.9.3)

Actions #49

Updated by Petr Pospisil over 14 years ago

  • % Done changed from 70 to 30

Hi, PDF export has still broken some chars in czech language. I have latest RFPDF plugin, Redmine 0.9.3 and all texts are stored in UTF-8. Doesn't matter if you apply #61. How to make it works? Thanks.

Actions #50

Updated by Vladimir Kovacik over 14 years ago

Besides updating the rfpdf plugin and applying the patch you need to make sure your selected language locale uses "general_pdf_encoding: UTF-8".
Despite I'm Slovak I prefer english language for my user in Redmine. However english locale contained "general_pdf_encoding: ISO-8859-1" which obviously cause problem in case. I changed it to UTF-8 and now it works smoothly...

Actions #51

Updated by Igor Isaenko over 14 years ago

Problem still exist even in this version of redmine (on this site)
Try click on http://www.redmine.org/issues/61.pdf

Actions #52

Updated by Aleksander Palyan over 14 years ago

This patch for trunk version. It work for trunk version. Check please.

  1. Update RFPDF with
    script/plugin install git://github.com/edwinmoss/rfpdf.git --force
    
  2. Apply attached patch
Actions #53

Updated by Adam Kubica over 14 years ago

This patch works fine for me.

Actions #54

Updated by Peter Volkov over 14 years ago

Works here too. Thank you Aleksander!

Actions #55

Updated by Alexey Palazhchenko over 14 years ago

New patch is basically the same as "pdf-0.8.4.patch" by Konstantin Ershov. I wonder why require 'rfpdf/chinese' is commented out?

Actions #56

Updated by Aleksander Palyan over 14 years ago

Alexey Palazhchenko wrote:

New patch is basically the same as "pdf-0.8.4.patch" by Konstantin Ershov. I wonder why require 'rfpdf/chinese' is commented out?

You are right. This row should be:

require 'fpdf/chinese'

Comment this because I didn't have time to research

Actions #57

Updated by Sin-young Kang about 14 years ago

I've enahnced Aleksander Palyan's patch for automatic enable/disable CJK helper modules by value of general_pdf_encoding.
(because CJK helper modules will troubles when UTF-8/Unicode mode.)
but it need to change font manually.

for UTF-8/Unicode font job, follow this guide.
http://code.google.com/p/rfpdf/source/browse/trunk/lib/fonts/ttf2ufm/README.TXT

Actions #58

Updated by Leo Hourvitz about 14 years ago

I tried Sin-young's enhanced patch against redmine-1.0.1 on Mac OS X 10.6. I did change the pdf encoding in the locale to utf-8 but had no other problems in English or Japanese, excepting of course the elephant in the room: because of the font problem Jeffrey mentioned, you only get hiragana and katakana in the output, so it's structurally complete and yet useless for real work!

I tried to convert one of my .ttf Japanese fonts with the ttf2utm utility but I couldn't get it to output a valid file.

Actions #59

Updated by Ahmed Skaik about 14 years ago

any idea if any of these patches work for Arabic PDF and CSV export ?
Check attachment

Thanks

Actions #60

Updated by Diego Felipe about 14 years ago

Hi, after updating the RFPDF my application stopped to work. I also applied this 61 patch, But the problem persists.
What did I do wrong?
Here is the stack trace:
A source file that the application requires, is missing.
Error message:
no such file to load -- rfpdf/fpdf (MissingSourceFile)
0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
1 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `require'
2 /srv/apps/redmine-1.0.1/vendor/rails/activesupport/lib/active_support/dependencies.rb 158 in `require'
3 /srv/apps/redmine-1.0.1/lib/redmine/export/pdf.rb 21
[..]

Line 21 is the "require 'rfpdf/fpdf'"

Any help?

Actions #61

Updated by Aleksander Palyan about 14 years ago

Diego Felipe wrote:

Hi, after updating the RFPDF my application stopped to work. I also applied this 61 patch, But the problem persists.
What did I do wrong?
Here is the stack trace:
A source file that the application requires, is missing.
Error message:
no such file to load -- rfpdf/fpdf (MissingSourceFile)
0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
1 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 31 in `require'
2 /srv/apps/redmine-1.0.1/vendor/rails/activesupport/lib/active_support/dependencies.rb 158 in `require'
3 /srv/apps/redmine-1.0.1/lib/redmine/export/pdf.rb 21
[..]

Line 21 is the "require 'rfpdf/fpdf'"

Any help?

It should to be "require 'fpdf/chinese'"

Actions #62

Updated by John Yani about 14 years ago

3 years passed. Could someone please to summarize, what is the progress? And when is it supposed to be fixed?

Actions #63

Updated by Siegfried Vogel almost 14 years ago

+1

Actions #64

Updated by Petr Pospisil almost 14 years ago

Czech characters in a PDF export are all right only when I have a unix OS, latest rfpdf and applied 61.patch. On a windows only digits and parenthesis are shown. Do you know any workaround? Thx.

(others fonts from latest rfpdf doesn't work due to a lot of issues inside)

Actions #65

Updated by Dmitriy Jamaro almost 14 years ago

In version 1.1.0 this method does not help.
who knows how to beat this problem?

Actions #66

Updated by Yuriy Vidineev almost 14 years ago

I modified 61.patch from Aleksander Palyan to work with redmine 1.1.0. Its work for me with redmine 1.1+nginx+mod_passenger+debian

Actions #67

Updated by Etienne Massip almost 14 years ago

  • Category set to PDF export
Actions #68

Updated by Etienne Massip almost 14 years ago

  • Target version set to Candidate for next major release
Actions #69

Updated by Jun NAITOH over 13 years ago

I merged 61-1.1.patch and #6505 note 9 patch.
This patch supports Japanese/Chinese/Korean and another language. (sorry, not support Thai, only.)

This patch for Redmine 1.1.2 version. Check please.

  1. Update RFPDF with http://github.com/edwinmoss/rfpdf/zipball/master
  2. Apply attached patch to Updated RFPDF (RFPDF's bug fix):
    • japanese.rb_rfpdf115.patch
    • korean.rb_rfpdf115.patch
    • chinese.rb_rfpdf115.patch
  3. Apply attached patch to Redmine:
    • pdf.rb_rfpdf115.patch
    • gantt.rb_rfpdf115.patch
    • locales_rfpdf115.patch (set "general_pdf_encoding: UTF-8" )

Changed by this patch.

general_pdf_encoding IFPDF's parent class font support locale reason
not UTF-8 FPDF UHC,SJIS, GB, Big5, Helvetica ja,ko,zh, zh-TW FreeSans doesn't support Japanese/Chinese/Korean/Thai character
UTF-8 TCPDF FreeSans other Helvetica doesn't support Cyrillic
  • Sorry, Thai character can't use. Because, I can't find Font that supports Thai.
Actions #70

Updated by Toshi MARUYAMA over 13 years ago

  • Assignee changed from Jean-Philippe Lang to Toshi MARUYAMA
Actions #71

Updated by Toshi MARUYAMA over 13 years ago

  • % Done changed from 30 to 0
Actions #72

Updated by Toshi MARUYAMA over 13 years ago

I imported Jun's patches and pushed my bitbucket and github repository.

Please try it.

Actions #73

Updated by Toshi MARUYAMA over 13 years ago

I got an error in Gantt PDF on Japanese locale.

NoMethodError in GanttsController#show

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

RAILS_ROOT: /REDMINE-1/hg-git/redmine-chili-mix-1
Application Trace | Framework Trace | Full Trace

/REDMINE-1/hg-git/redmine-chili-mix-1/vendor/plugins/rfpdf/lib/fpdf/japanese.rb:89:in `GetStringWidth'
/REDMINE-1/hg-git/redmine-chili-mix-1/vendor/plugins/rfpdf/lib/tcpdf.rb:1707:in `Cell'
/REDMINE-1/hg-git/redmine-chili-mix-1/lib/redmine/export/pdf.rb:127:in `UTF8Cell'
/REDMINE-1/hg-git/redmine-chili-mix-1/lib/redmine/helpers/gantt.rb:517:in `to_pdf'
/REDMINE-1/hg-git/redmine-chili-mix-1/app/controllers/gantts_controller.rb:28:in `show'
/REDMINE-1/hg-git/redmine-chili-mix-1/app/controllers/gantts_controller.rb:25:in `show'

Actions #74

Updated by Jun NAITOH over 13 years ago

I checked https://github.com/marutosi/redmine/commits/bb-issue61-pdf.
It's correct patched source.

I tried it in Japanese locale, so The same error occurred in production mode.
but, in development mode (RAILS_ENV = 'development'), I don't detect error. why?

I tried to debug. I found...

I changed by way of experiment as follows. so, it doesn't detect error...

#      class IFPDF < (l(:general_pdf_encoding).upcase == 'UTF-8' ? TCPDF : FPDF )
      class IFPDF < (l(:general_pdf_encoding).upcase != 'UTF-8' ? TCPDF : FPDF )

#        alias alias_nb_pages AliasNbPages if l(:general_pdf_encoding).upcase != 'UTF-8'
        alias alias_nb_pages AliasNbPages if l(:general_pdf_encoding).upcase == 'UTF-8'

I think that TCPDF is called by mistake in Japanese locale....

Actions #75

Updated by Jun NAITOH over 13 years ago

sorry, I changed by way of experiment file name is "lib/redmine/export/pdf.rb"

Actions #76

Updated by Toshi MARUYAMA over 13 years ago

Toshi MARUYAMA wrote:

I imported Jun's patches and pushed my bitbucket and github repository.

I noticed these repositories have ".svn/" meta data.
I re-generated revision history.
Please use bb-issue61-pdf-1 git branch.
On Mercurial, I created new named branch "issue61-pdf-1".

Actions #77

Updated by Jun NAITOH over 13 years ago

Toshi MARUYAMA wrote:

I got an error in Gantt PDF on Japanese locale.

[...]

Sorry, I had tested in development mode.
Note 69 patch has problem in production mode.

I rewrote pdf.rb_rfpdf115.patch(pdf.rb_rfpdf115_2.patch) and gantt.rb_rfpdf115.patch(gantt.rb_rfpdf115_2.patch).
This patch's logic same.

And, the pdf.rb and gantt.rb files(for Toshi's github) is appended, too.

Actions #78

Updated by Toshi MARUYAMA over 13 years ago

  • % Done changed from 0 to 70
Actions #79

Updated by Jun NAITOH over 13 years ago

tcpdf_binary.patch fixed the problem that TCPDF built-in font breaks in the Windows environment.

This problem occurs because the EOF character string is included in the built-in font.

I tested by BitNami(Redmine 1.1.2) on Windows XP sp3(Japanese).

Actions #80

Updated by Jun NAITOH over 13 years ago

I'm sorry, my correct test environment is the following.

I tested by BitNami(Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese), and English locale.

Jun NAITOH wrote:

I tested by BitNami(Redmine 1.1.2) on Windows XP sp3(Japanese).

Actions #81

Updated by Jun NAITOH over 13 years ago

r5258_chinese.rb.patch corrects the width calculation of multi byte character for chinese.rb.
r5258_chinese.rb.patch is an additional patch to r5258.

This is related to #1170 patch.

Redmin 1.1.2 chinese.rb logic (Please see #1170.)

  • UTF-8(3byte) --> MultiCell(chinese.rb) -->
  • -- UTF-8(3byte) --> Cell(pdf.rb : use iconv) -->
  • -- zh(2byte) --> Cell(fpdf.rb)

This patch's logic

  • UTF-8(3byte) --> RDMMultiCell(pdf.rb) -->
  • -- UTF-8(3byte) --> fix_text_encoding(pdf.rb : use iconv) -- zh(2byte) --> MultiCell(chinese.rb) -->
  • -- zh(2byte) --> Cell(fpdf.rb)

Sample (zh locale test)

  • chinese_trunk.pdf : trunk now
  • chinese_trunk_patched.pdf : trunk + patch
Actions #82

Updated by Jun NAITOH over 13 years ago

pdf_ruby19.patch is for Ruby1.9 compatibility on FPDF (Japanese/Chinese/Korean)
When I tested, TCPDF is already compatible with Ruby 1.9.

My test environment is as follows.

  • Ruby1.9 compatibility Test
    • CentOS 5.5(x86)
    • Ruby 1.9.2 + rails 2.3.11 + i18n-0.4.2 + trunk
  • Ruby1.8 compatibility Test
    • BitNami(Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese)
Actions #83

Updated by Jun NAITOH over 13 years ago

Sorry, note 82 patch don't work on ruby 1.8.6.
"ord" method is ruby 1.8.7 and 1.9 later.
Please wait, I rewite patch.

Actions #84

Updated by Jun NAITOH over 13 years ago

I rewrote pdf_ruby19.patch2 for trunk.

My test environment is as follows.

  • Ruby1.9 compatibility Test
    • CentOS 5.5(x86) Ruby 1.9.2 + rails 2.3.11 + i18n-0.4.2 + trunk
  • Ruby1.8 compatibility Test
    • BitNami(Ruby 1.8.7 + Redmine 1.1.2 + trunk(rfpdf, pdf.rb, gantt.rb)) on Windows XP sp3(Japanese)
    • CentOS 5.5(x86) Ruby 1.8.6 + rails 2.3.11 + i18n-0.4.2 + trunk
Actions #85

Updated by Jun NAITOH over 13 years ago

pdf.rb_illegal_character.patch is support for include illegal character string case.

Actions #86

Updated by Toshi MARUYAMA over 13 years ago

  • Target version changed from Candidate for next major release to 1.2.0
  • % Done changed from 70 to 100
Actions #87

Updated by staccatissimo Lee over 13 years ago

Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?

Actions #88

Updated by Toshi MARUYAMA over 13 years ago

staccatissimo Lee wrote:

Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?

I finished commiting Jun's patches to SVN trunk.
Please checkout SVN trunk or clone github or bitbucket mirror and test it.

Actions #89

Updated by staccatissimo Lee over 13 years ago

Toshi MARUYAMA wrote:

staccatissimo Lee wrote:

Sorry guys, I am quite new to this. Is there anyone kind enough to teach me the steps to patch my system to fix PDF?

I finished commiting Jun's patches to SVN trunk.
Please checkout SVN trunk or clone github or bitbucket mirror and test it.

Thanks man, I tried "svn co http://redmine.rubyforge.org/svn/trunk redmine". but my redmine still export strange code when message is written in Chinese. Is there anything I missed?

Actions #90

Updated by Toshi MARUYAMA over 13 years ago

Thank you for your feedback.
Could you give us pdf and screen shot?

Actions #91

Updated by staccatissimo Lee over 13 years ago

steps I have tried:
"svn co http://redmine.rubyforge.org/svn/trunk redmine"

Actions #92

Updated by Toshi MARUYAMA over 13 years ago

Check your database encoding is UTF-8.
MySQL default encoding is Latin-1(ISO-8859-1).

In English locale, Redmine trunk uses embedded FreeSans font.
FreeSans does not have Chinese HANJI (漢字).
In Simplified and Traditional Chinese locale, Redmine trunk uses non embedded font.

Actions #93

Updated by Toshi MARUYAMA over 13 years ago

Actions #94

Updated by staccatissimo Lee over 13 years ago

Thanks for your prompt response!

The database should be in UTF-8, as it could display Chinese on the Redmine web interface.

As of locale, thank you very much for the inspiration.
The PDF is in good shape when I switch to Chinese Interface.
Is there anyway I could use English interface and generate Chinese PDF.

p.s. Attached pls find the screenshots

Actions #95

Updated by Toshi MARUYAMA over 13 years ago

staccatissimo Lee wrote:

Is there anyway I could use English interface and generate Chinese PDF.

There is no way for some reasons.

  • FreeSans font does not have HANJI (漢字), but it has Japanese HIRAGANA (ひらがな) and KATAKANA (カタカナ).
  • Unified CJK problem.
  • I am Japanese. Japanese can not accept free font quality.
Actions #96

Updated by Toshi MARUYAMA over 13 years ago

Actions #97

Updated by Toshi MARUYAMA over 13 years ago

staccatissimo Lee wrote:

The database should be in UTF-8, as it could display Chinese on the Redmine web interface.

If your database is MySQL, try following command.

mysql> show variables like "char%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
Actions #98

Updated by staccatissimo Lee over 13 years ago

Toshi MARUYAMA wrote:

staccatissimo Lee wrote:

Is there anyway I could use English interface and generate Chinese PDF.

There is no way for some reasons.

  • FreeSans font does not have HANJI (漢字), but it has Japanese HIRAGANA (ひらがな) and KATAKANA (カタカナ).
  • Unified CJK problem.
  • I am Japanese. Japanese can not accept free font quality.

Dear Toshi,

Thank you very much! Your advices are very helpful!
Now I managed to Print PDF in with Chinese correctly.

One more think to add, is there any way I could change to font type? It is because the Chinese PDF does not look good, although the display is correct. Is there any way I could modify the RFPDF so to change the font name?

Actions #99

Updated by Toshi MARUYAMA over 13 years ago

staccatissimo Lee wrote:

One more think to add, is there any way I could change to font type? It is because the Chinese PDF does not look good, although the display is correct. Is there any way I could modify the RFPDF so to change the font name?

Font names are hard-coded at source:trunk/vendor/plugins/rfpdf/lib/fpdf/chinese.rb#L80 .

Actions #100

Updated by Toshi MARUYAMA over 13 years ago

You can change font name to edit source:trunk/lib/redmine/export/pdf.rb#L102 .

Actions #101

Updated by Yuriy Vidineev over 13 years ago

works great with cyrillic. Thank you!

Actions #102

Updated by Jun NAITOH over 13 years ago

staccatissimo Lee wrote:

Is there anyway I could use English interface and generate Chinese PDF.

pdf_encoding.patch and locales_encoding.patch switch to use to "general_pdf_encoding" from "current_language".

If you are an English locale(use en.yml), set "general_pdf_encoding: gb18030" in en.yml.
So you can use English interface and generate Chinese PDF.

Actions #103

Updated by Jun NAITOH over 13 years ago

I found 0x5c char handling bug, for Japanese and Chinese PDF. (Korean PDF don't have 0x5c char handling problem.)

I had done the 0x5c escape processing before using japanese.rb (chinese.rb).
Therefore, the mistake occurred in byte calculation because the number of 0x5c escape characters increased.

sample : This problem occurs by the character string that contains 0x5c.

能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能能

And, I found the bug of the 0x5c escape processing of FPDF. (This bug has already been fixed in TCPDF.)

Actions #104

Updated by Toshi MARUYAMA over 13 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Summary

general_pdf_encoding Class Font name Font type Support locales
Not UTF-8 FPDF UHC,SJIS, GB, Big5, Helvetica Non embedded ja,ko,zh, zh-TW FreeSans doesn't support Japanese/Chinese/Korean/Thai characters
UTF-8 TCPDF FreeSans Embedded Others Helvetica doesn't support Cyrillic

If you have a problem, please create a new issue.

Actions

Also available in: Atom PDF