Defect #61

Broken character encoding in pdf export

Added by Nikolay Solakov over 9 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:HighDue date:
Assignee:Toshi MARUYAMA% Done:

100%

Category:PDF export
Target version:1.2.0
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.

export.pdf (2.24 KB) Nikolay Solakov, 2008-02-03 10:50

issues.jpg (128 KB) Nikolay Solakov, 2008-02-03 10:50

bulg.pdf (308 KB) Jan Topiński, 2008-11-16 15:02

61.patch Magnifier (2.48 KB) Jan Topiński, 2008-11-16 15:02

redmine-2022_fr.pdf (308 KB) Jean-Philippe Lang, 2008-11-18 18:32

redmine-2022_bg.pdf (308 KB) Jean-Philippe Lang, 2008-11-18 18:32

redmine-sc-15850.pdf (315 KB) Ernad Husremovic, 2008-11-18 20:13

praw-pl-fr.pdf (376 KB) Jan Topiński, 2008-11-23 01:48

praw-jp.png (58.1 KB) Jan Topiński, 2008-11-23 01:52

prawn.patch Magnifier (4 KB) Jan Topiński, 2008-11-25 23:50

prawn.patch Magnifier (4.05 KB) Heejong Lee, 2008-11-27 10:53

export-4.png (24.2 KB) Alexey Kornilov, 2009-03-11 14:55

rfpdf-korean.diff Magnifier (1.51 KB) Gyoung-Yoon Noh, 2009-05-21 04:17

pdf-0.8.4.patch Magnifier (2.04 KB) Konstantin Ershov, 2009-06-02 13:54

prawn.patch Magnifier (3.97 KB) chaninan jitonnom, 2009-11-24 03:49

61.patch Magnifier (1.89 KB) Aleksander Palyan, 2010-09-01 16:43

61-enhanced.patch Magnifier - Enhanced patch over Aleksander Palyan's (3.1 KB) Sin-young Kang, 2010-09-26 16:32

arabic_PDF.png (103 KB) Ahmed Skaik, 2010-10-18 18:27

61-1.1.patch Magnifier (1.58 KB) Yuriy Vidineev, 2011-01-27 11:25

korean.rb_rfpdf115.patch Magnifier (2.32 KB) Jun NAITOH, 2011-03-27 09:34

pdf.rb_rfpdf115.patch Magnifier (13.1 KB) Jun NAITOH, 2011-03-27 09:34

gantt.rb_rfpdf115.patch Magnifier (5.38 KB) Jun NAITOH, 2011-03-27 09:34

locales_rfpdf115.patch Magnifier (10.1 KB) Jun NAITOH, 2011-03-27 09:34

chinese.rb_rfpdf115.patch Magnifier (4.67 KB) Jun NAITOH, 2011-03-27 09:34

japanese.rb_rfpdf115.patch Magnifier (2.02 KB) Jun NAITOH, 2011-03-27 09:34

gantt.rb_rfpdf115_2.patch Magnifier (5.64 KB) Jun NAITOH, 2011-03-29 16:08

pdf.rb_rfpdf115_2.patch Magnifier (12.7 KB) Jun NAITOH, 2011-03-29 16:08

gantt.rb Magnifier (31.8 KB) Jun NAITOH, 2011-03-29 16:08

pdf.rb Magnifier (12.7 KB) Jun NAITOH, 2011-03-29 16:08

tcpdf_binary.patch Magnifier - for trunk patch (2.1 KB) Jun NAITOH, 2011-04-02 05:46

r5258_chinese.rb.patch Magnifier (800 Bytes) Jun NAITOH, 2011-04-02 09:09

chinese_trunk.pdf (5.23 KB) Jun NAITOH, 2011-04-02 09:09

chinese_trunk_patched.pdf (5.23 KB) Jun NAITOH, 2011-04-02 09:09

pdf_ruby19.patch Magnifier (2.71 KB) Jun NAITOH, 2011-04-04 00:47

pdf_ruby19.patch2 (2.43 KB) Jun NAITOH, 2011-04-04 16:20

pdf.rb_illegal_character.patch Magnifier (988 Bytes) Jun NAITOH, 2011-04-06 01:08

20110408-01.png (66.7 KB) staccatissimo Lee, 2011-04-08 10:07

issue-list.png (17.8 KB) Toshi MARUYAMA, 2011-04-08 11:23

freesans-font.png (39.5 KB) Toshi MARUYAMA, 2011-04-08 11:23

english.pdf (307 KB) Toshi MARUYAMA, 2011-04-08 11:23

Simplified-Chinese.pdf (5.25 KB) Toshi MARUYAMA, 2011-04-08 11:23

20110408-02.png (83.4 KB) staccatissimo Lee, 2011-04-08 11:48

pdf_encoding.patch Magnifier (2.96 KB) Jun NAITOH, 2011-04-10 01:52

locales_encoding.patch Magnifier (9.7 KB) Jun NAITOH, 2011-04-10 01:52

encoding.png (27.4 KB) Jun NAITOH, 2011-04-10 01:52

pdf_0x5c_char_handling.patch Magnifier (1.93 KB) Jun NAITOH, 2011-04-29 00:07


Related issues

Related to Redmine - Feature #3794: UTF in issue generated report Closed 2009-08-29
Related to Redmine - Defect #4375: how to export PDF in Thai using Redmine 0.8.7 Closed 2009-12-10
Related to Redmine - Defect #4708: export to PDF do not work correctly with Czech language Closed 2010-02-01
Related to Redmine - Defect #7287: PDF Export Turkish characters not showing Closed 2011-01-11
Related to Redmine - Defect #7794: Internal server error on formatting an issue as a PDF in ... Closed 2011-03-06
Related to Redmine - Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) charac... Closed 2010-02-10
Related to Redmine - Defect #9: Export feature(to csv/pdf) doesn't work (in Japanese) Closed
Related to Redmine - Defect #7373: Error with PDF output and ruby 1.9.2 Closed 2011-01-19
Related to Redmine - Patch #5629: Wrap text fields properly in PDF Closed 2010-06-01
Related to Redmine - Patch #8312: Switch to TCPDF from FPDF for PDF export Closed 2011-05-06
Related to Redmine - Defect #5024: Internal error after clicking on link to PDF Export Closed 2010-03-10
Related to Redmine - Defect #8565: JRuby: Japanese PDF export error Closed 2011-06-08
Related to Redmine - Defect #8566: Exported PDF UTF-8 Vietnamese not correct Closed 2011-06-08
Related to Redmine - Feature #69: Textilized description in PDF Closed
Related to Redmine - Defect #11927: Vietnamese Unicode charater broken when exporting to PDF Closed
Duplicates Redmine - Defect #76: PDF fonts must be in UTF-8 Closed
Duplicated by Redmine - Defect #856: Export issue to PDF - broken character encoding Closed 2008-03-14
Duplicated by Redmine - Defect #3092: Wrong encoding in Gantt / PDF export Closed 2009-04-01
Duplicated by Redmine - Defect #3894: Wrong encoding in PDF export with Korean Closed 2009-09-20
Duplicated by Redmine - Feature #4012: Out Of The Box full PDF internationalization Closed 2009-10-09
Duplicated by Redmine - Defect #4220: Export to PDF in thai language it doesn't work Closed 2009-11-15
Duplicated by Redmine - Defect #5064: Garbled or unsupported characters in PDF output (utf-8) Closed 2010-03-12
Duplicated by Redmine - Defect #6999: Export PDF is broken for Mongolian language Closed 2010-11-29 2010-12-05
Duplicated by Redmine - Feature #4699: Export PDF in Chinese and Japanese language is get well i... Closed 2010-01-31
Duplicated by Redmine - Defect #5884: PDF export doesn't work for Hebrew Closed 2010-07-15
Duplicated by Redmine - Defect #6505: PDF export broken with Japanese (Gannt and Issue Tracking) Closed 2010-09-27
Duplicated by Redmine - Defect #7019: Issue pdf export Closed 2010-12-02
Duplicated by Redmine - Defect #7833: pdf export problem Closed 2011-03-11
Duplicated by Redmine - Defect #6506: Gantt chart export to PDF/PNG works incorrectly in zh-tw ... Closed 2010-09-27
Duplicated by Redmine - Defect #7461: Special chars / umlauts broken in CSV / PDF export Closed
Duplicated by Redmine - Defect #8455: Cyrillic output in PDF Closed 2011-05-28

Associated revisions

Revision 5233
Added by Toshi MARUYAMA over 5 years ago

i18n: fix typo general_pdf_encoding "UFT-8" in sl.yml (#61).

Revision 5247
Added by Toshi MARUYAMA over 5 years ago

PDF: update rfpdf (#61).

https://github.com/edwinmoss/rfpdf
revision a04724b4af95c15a99675b34e353c15534d20411

Revision 5248
Added by Toshi MARUYAMA over 5 years ago

PDF: add missing rfpdf requires (#61).

Revision 5249
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r287 (#61).

Fix for #9.
Export feature(to csv/pdf) doesn't work in Japanese
csv and pdf encoding are know defined for each language
(general_csv_encoding and general_pdf_encoding keys in lang files)
added SJIS font for japanese pdf exports.

Revision 5250
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r393 (#61).

Added chinese simplified translation (Andy Wu)
Fixed rfpdf chinese.rb

Revision 5251
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r3389 (#61).

Korean support for PDF export (#4639).

Revision 5252
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r1497 (#61).

Fixes Chinese pdf export when the issue description is too long (#1170).

Revision 5253
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r5183 (#61).

Fix an internal server error on formatting an issue as a PDF in Japanese (#7794).

Contributed by Yuki Sonoda.

Revision 5254
Added by Toshi MARUYAMA over 5 years ago

PDF: transplant r4602 (#61).

Ruby1.9 compatibility.

Revision 5255
Added by Toshi MARUYAMA over 5 years ago

PDF: comment out memoizes (#61).

Revision 5256
Added by Toshi MARUYAMA over 5 years ago

PDF: import CJK patches (#61).

Contributed by Jun NAITOH.

Revision 5257
Added by Toshi MARUYAMA over 5 years ago

PDF: comment out Mime pdf in vendor/plugins/rfpdf/init.rb (#61).

Revision 5258
Added by Toshi MARUYAMA over 5 years ago

PDF: prepare switching TCPDF UTF-8 in non CJK or FPDF ANSI in CJK (#61).

Revision 5259
Added by Toshi MARUYAMA over 5 years ago

PDF: switch TCPDF UTF-8 or FPDF ANSI (#61).

If server is Windows or language is CJK or Thai, Redmine uses FPDF.
Else Redmine uses TCPDF.

Revision 5267
Added by Toshi MARUYAMA over 5 years ago

PDF: fix syntax errors at vendor/plugins/rfpdf/lib/tcpdf.rb on Ruby 1.9 (#61).

Revision 5281
Added by Toshi MARUYAMA over 5 years ago

PDF: back out r5253 (#7794, #61).

r5256 fixed #7794 completely.
r5253 effects the width of the ASCII character of Japanese PDF.

Contributed by Jun NAITOH.

Revision 5290
Added by Toshi MARUYAMA over 5 years ago

PDF: fix the problem that TCPDF built-in font breaks in the Windows (#61).

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

Contributed by Jun NAITOH.

Revision 5291
Added by Toshi MARUYAMA over 5 years ago

PDF: set enable to use TCPDF UTF-8 on Windows except CJK and Thai (#61).

Contributed by Jun NAITOH.

Revision 5295
Added by Toshi MARUYAMA over 5 years ago

PDF: fix width calculation of multi byte character in Simplified and Traditional Chinese (#61).

Contributed by Jun NAITOH.

Revision 5306
Added by Toshi MARUYAMA over 5 years ago

PDF: remove replacing non ASCII quotation marks (#61).

Languages except CJK and Thailand use TCPDF UTF-8.
TCPDF UTF-8 supports these quotation marks.

Contributed by Jun NAITOH.

Revision 5331
Added by Toshi MARUYAMA over 5 years ago

PDF: Ruby 1.9 compatibility for FPDF ANSI (#61).

Contributed by Jun NAITOH.

Revision 5337
Added by Toshi MARUYAMA over 5 years ago

PDF: create new unit lib pdf test and add '0x5c'(backslash) handling test (#61, #117).

Japanese Shift_JIS and Traditional Chinese Big5 have '0x5c'(backslash) problem.

Revision 5339
Added by Toshi MARUYAMA over 5 years ago

PDF: set language 'ja' in '0x5c'(backslash) handling unit lib test (#61, #117).

Revision 5341
Added by Toshi MARUYAMA over 5 years ago

PDF: fix \\(double backslashes) handling of FPDF ANSI (#61, #117).

Revision 5342
Added by Toshi MARUYAMA over 5 years ago

PDF: add \\(double backslashes) handling of FPDF ANSI test in unit lib test (#61, #117).

Revision 5343
Added by Toshi MARUYAMA over 5 years ago

PDF: Ruby 1.9 compatibility of '0x5c'(backslash) handling in FPDF ANSI (#61, #117).

Japanese Shift_JIS and Traditional Chinese Big5 have '0x5c'(backslash) problem.

Revision 5344
Added by Toshi MARUYAMA over 5 years ago

PDF: add test of Ruby 1.9 compatibility of '0x5c'(backslash) handling in FPDF ANSI (#61, #117).

Japanese Shift_JIS and Traditional Chinese Big5 have '0x5c'(backslash) problem.

Revision 5350
Added by Toshi MARUYAMA over 5 years ago

PDF: add test of replacing converting error characters in FPDF ANSI on Ruby 1.9 (#61).

Revision 5351
Added by Toshi MARUYAMA over 5 years ago

PDF: replace converting error characters instead of returning UTF-8 in FPDF ANSI on Ruby 1.8 (#61).

In Japan, UTF-8 characters in Shift_JIS(CP932) becomes garbling(MOJI-BAKE).

Revision 5352
Added by Toshi MARUYAMA over 5 years ago

PDF: add test of replacing converting error characters in FPDF ANSI on Ruby 1.8 (#61).

Revision 5378
Added by Toshi MARUYAMA over 5 years ago

PDF: change "utf8" of general_pdf_encoding to "UTF-8" in bs.yml and hr.yml (#61).

Revision 5382
Added by Toshi MARUYAMA over 5 years ago

PDF: set general_pdf_encoding UTF-8 on non CJK and Thailand locales (#61).

Current trunk uses TCPDF without general_pdf_encoding value on non CJK and Thailand locales.
This commit purpose is preparing switching TCPDF or FPDF with general_pdf_encoding value
instead of language value such as 'ja'.

Revision 5383
Added by Toshi MARUYAMA over 5 years ago

PDF: switch FPDF font with general_pdf_encoding value instead of language value such as 'ja' (#61).

Revision 5385
Added by Toshi MARUYAMA over 5 years ago

PDF: switch FPDF ANSI or TCPDF UTF-8 with general_pdf_encoding value instead of language value such as 'ja' (#61).

Revision 5565
Added by Toshi MARUYAMA over 5 years ago

PDF: fix 0x5c(backslash) escape processing in FPDF (#61).

Japanese CP932 and Traditional Chinese Big5 have 0x5c(backslash) problem.

Contributed Jun NAITOH.

Revision 5566
Added by Toshi MARUYAMA over 5 years ago

PDF: add test of ensuring 'ASCII-8BIT' encoding in Ruby 1.9 (#61).

Japanese CP932 and Traditional Chinese Big5 have 0x5c(backslash) problem,
and these are incompatible with ASCII.

Revision 5598
Added by Toshi MARUYAMA over 5 years ago

PDF: use explicit return value in Redmine::Export::PDF.fix_text_encoding() (#61).

Revision 5713
Added by Toshi MARUYAMA over 5 years ago

PDF: move fix_text_encoding() logic to new method for common use in FPDF and TCPDF (#61, #8312).

Revision 5715
Added by Toshi MARUYAMA over 5 years ago

PDF: replace invalid sequence in converting if encoding destination is UTF-8 (#61, #8312).

Revision 5716
Added by Toshi MARUYAMA over 5 years ago

PDF: replace invalid UTF-8 sequences in TCPDF (#61, #8312).

There is no guarantees that database strings are valid UTF-8 in Ruby 1.8 MySQL and SQLite3.

Revision 6010
Added by Toshi MARUYAMA about 5 years ago

PDF: add SJIS and Shift_JIS in lib/redmine/export/pdf.rb for Japanese ja.yml general_pdf_encoding (#8565, #61).

JRuby 1.6.2 (ruby-1.8.7-p330) does not support CP932.

Revision 6011
Added by Toshi MARUYAMA about 5 years ago

PDF: add Japanese comment of ja.yml general_pdf_encoding CP932 and SJIS in JRuby and CRuby (#8565, #61).

Revision 6012
Added by Toshi MARUYAMA about 5 years ago

PDF: change Shift_JIS to SHIFT_JIS in lib/redmine/export/pdf.rb for Japanese ja.yml general_pdf_encoding (#8565, #61).

Revision 6013
Added by Toshi MARUYAMA about 5 years ago

PDF: use SJIS instead of CP932 at unit pdf test_fix_text_encoding_nil in JRuby (#8565, #61).

Revision 6015
Added by Toshi MARUYAMA about 5 years ago

Merged r6011 from trunk.

PDF: add Japanese comment of ja.yml general_pdf_encoding CP932 and SJIS in JRuby and CRuby (#8565, #61).

Revision 6022
Added by Toshi MARUYAMA about 5 years ago

PDF: use SJIS instead of CP932 at unit pdf test test_rdm_pdf_iconv_cannot_convert_ja_cp932 in JRuby (#8565, #61).

Revision 6023
Added by Toshi MARUYAMA about 5 years ago

PDF: use SJIS instead of CP932 at unit pdf test test_rdm_pdf_iconv_invalid_utf8_should_be_replaced_ja in JRuby (#8565, #61).

Revision 6024
Added by Toshi MARUYAMA about 5 years ago

PDF: replace all non ASCII characters to '?' if Iconv error raise in JRuby (#8569, #61).

History

#1 Updated by Michael Pirogov over 8 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.

#2 Updated by David Fugere over 8 years ago

have you found an answer?

#3 Updated by Nikolay Solakov over 8 years ago

Can anyone solve this old puzzle?

Thanks,
Nikolay

#4 Updated by Jean-Philippe Lang about 9 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.

#5 Updated by Nikolay Solakov over 9 years ago

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

Thanks,
Nikolay

#6 Updated by Jan Topiński almost 8 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.

#7 Updated by Paul Rivier almost 8 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 ?

#8 Updated by Jean-Philippe Lang almost 8 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?

#9 Updated by Ernad Husremovic almost 8 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.

#10 Updated by David Strejc almost 8 years ago

I can confirm that this patch works for Czech language.

#11 Updated by Sergej Jegorov almost 8 years ago

I confirm, that patch works for Lithuanian language.

#12 Updated by Azamat Hackimov almost 8 years ago

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

#13 Updated by Jean-Philippe Lang almost 8 years ago

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

#14 Updated by Jan Topiński almost 8 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.

#15 Updated by Jan Topiński almost 8 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.

#16 Updated by Jan Topiński almost 8 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.

#17 Updated by Jean-Philippe Lang almost 8 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 ?

#18 Updated by Jean-Philippe Lang almost 8 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.

#19 Updated by Jean-Philippe Lang almost 8 years ago

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

#20 Updated by Eric Davis almost 8 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.

#21 Updated by Jan Topiński almost 8 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.

#22 Updated by Heejong Lee over 7 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.

#23 Updated by Jean-Philippe Lang over 7 years ago

  • Status changed from New to Closed

Dup of #61.

#24 Updated by Jean-Philippe Lang over 7 years ago

  • Status changed from Closed to New

#25 Updated by Jean-Philippe Lang over 7 years ago

  • Subject changed from export to pdf to Broken character encoding in pdf export

#26 Updated by Alexey Kornilov over 7 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

#27 Updated by Maxim Krušina over 7 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?

#28 Updated by Gyoung-Yoon Noh over 7 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.

#29 Updated by Gyoung-Yoon Noh over 7 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.

#30 Updated by Stanislav German-Evtushenko over 7 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.

#31 Updated by Szymon Połom over 7 years ago

Can confirm this issue.

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

#32 Updated by Konstantin Ershov about 7 years ago

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

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

#33 Updated by Konstantin Ershov about 7 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.

#34 Updated by Subramanian N about 7 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

#35 Updated by Sergey Tatarenkov almost 7 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.

#36 Updated by chaninan jitonnom almost 7 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.

#37 Updated by chaninan jitonnom almost 7 years ago

  • % Done changed from 30 to 0

#38 Updated by chaninan jitonnom almost 7 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?

#39 Updated by Krzysztof Podejma almost 7 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?

#40 Updated by chaninan jitonnom almost 7 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, @project), :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 .

#41 Updated by Nikolay Kotlyarov over 6 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.

#42 Updated by K S over 6 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?

#43 Updated by K S over 6 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!).

#44 Updated by Jeffrey Jones over 6 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?

#45 Updated by Jeffrey Jones over 6 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.

#46 Updated by Jeffrey Jones over 6 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?

#47 Updated by Kirill Ponomarev over 6 years ago

Is there any progress in this issue?

#48 Updated by Nikolay Kotlyarov over 6 years ago

CSV export also broken in russian (Redmine 0.9.3)

#49 Updated by Petr Pospisil over 6 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.

#50 Updated by Vladimir Kovacik about 6 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...

#51 Updated by Igor Isaenko about 6 years ago

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

#52 Updated by Aleksander Palyan almost 6 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

#53 Updated by Adam Kubica almost 6 years ago

This patch works fine for me.

#54 Updated by Peter Volkov almost 6 years ago

Works here too. Thank you Aleksander!

#55 Updated by Alexey Palazhchenko almost 6 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?

#56 Updated by Aleksander Palyan almost 6 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

#57 Updated by Sin-young Kang almost 6 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

#58 Updated by Leo Hourvitz almost 6 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.

#59 Updated by Ahmed Skaik almost 6 years ago

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

Thanks

#60 Updated by Diego Felipe almost 6 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?

#61 Updated by Aleksander Palyan almost 6 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'"

#62 Updated by John Yani over 5 years ago

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

#63 Updated by Siegfried Vogel over 5 years ago

+1

#64 Updated by Petr Pospisil over 5 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)

#65 Updated by Dmitriy Jamaro over 5 years ago

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

#66 Updated by Yuriy Vidineev over 5 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

#67 Updated by Etienne Massip over 5 years ago

  • Category set to PDF export

#68 Updated by Etienne Massip over 5 years ago

  • Target version set to Candidate for next major release

#69 Updated by Jun NAITOH over 5 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.

#70 Updated by Toshi MARUYAMA over 5 years ago

  • Assignee changed from Jean-Philippe Lang to Toshi MARUYAMA

#71 Updated by Toshi MARUYAMA over 5 years ago

  • % Done changed from 30 to 0

#72 Updated by Toshi MARUYAMA over 5 years ago

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

Please try it.

#73 Updated by Toshi MARUYAMA over 5 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'

#74 Updated by Jun NAITOH over 5 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....

#75 Updated by Jun NAITOH over 5 years ago

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

#76 Updated by Toshi MARUYAMA over 5 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".

#77 Updated by Jun NAITOH over 5 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.

#78 Updated by Toshi MARUYAMA over 5 years ago

  • % Done changed from 0 to 70

#79 Updated by Jun NAITOH over 5 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).

#80 Updated by Jun NAITOH over 5 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).

#81 Updated by Jun NAITOH over 5 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

#82 Updated by Jun NAITOH over 5 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)

#83 Updated by Jun NAITOH over 5 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.

#84 Updated by Jun NAITOH over 5 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

#85 Updated by Jun NAITOH over 5 years ago

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

#86 Updated by Toshi MARUYAMA over 5 years ago

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

#87 Updated by staccatissimo Lee over 5 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?

#88 Updated by Toshi MARUYAMA over 5 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.

#89 Updated by staccatissimo Lee over 5 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?

#90 Updated by Toshi MARUYAMA over 5 years ago

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

#91 Updated by staccatissimo Lee over 5 years ago

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

#92 Updated by Toshi MARUYAMA over 5 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.

#94 Updated by staccatissimo Lee over 5 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

#95 Updated by Toshi MARUYAMA over 5 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.

#97 Updated by Toshi MARUYAMA over 5 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/ |
+--------------------------+----------------------------+

#98 Updated by staccatissimo Lee over 5 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?

#99 Updated by Toshi MARUYAMA over 5 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 .

#100 Updated by Toshi MARUYAMA over 5 years ago

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

#101 Updated by Yuriy Vidineev over 5 years ago

works great with cyrillic. Thank you!

#102 Updated by Jun NAITOH over 5 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.

#103 Updated by Jun NAITOH over 5 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.)

#104 Updated by Toshi MARUYAMA over 5 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.

Also available in: Atom PDF