プロジェクト

全般

プロフィール

Vote #75438

完了

use rbpdf gem instead of bundled rfpdf

Admin Redmine さんがほぼ4年前に追加. ほぼ4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
PDF export_39
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
39
version_id:
81
issue_org_id:
17570
author_id:
30580
assigned_to_id:
11192
comments:
27
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

I updated rfpdf base version to TCPDF 5.1.002 from 1.53.0.TC031 for Redmine trunk.

h3. main feature

  • Use UTF-8 encoding.
  • RTL (Right-To-Left) languages support was added.
  • HTML tag inside table supported.
  • CSS minimum support.
  • Bookmark support.
  • Adhoc Thai language support. (Bold font not support)
  • Image ** 8bit PNG image support without RMagick liblary. ** 16bit PNG image support. (use RMagick liblary) ** Alpha channel PNG image adhoc support. (use RMagick liblary) ** JPEG image support. (use RMagick liblary) ** GIF image support. (use RMagick liblary)

h3. fixed issues

  • #8753 : RTL languages supoorted.
  • #14466 : This patch fixed.
  • #13860 : This patch fixed.
  • #13589 : default_table_columns parameter is invalid now.
  • #14599 : Support 16-bit depth PNG images with RMagick libray.
  • #12934 : Support images in tables.
  • #14917 : Supported style of center at Table.

h3. fixed issues (adhoc)

  • #12934 : Supported style of text-align right/center/left attribute, but no vertical-align attribute, yet.
  • #12447 : Convert alpha channel to black.

h3. Gem file

gem install rfpdf

h3. patch

  • lib_redmine.rb_r13333.patch : Gantt/Issues list/Issue/Wiki PDF export patch.
  • config_localse_r13333.patch : general_pdf_encoding is set UTF-8 locale.

h3. my testing environment

  • Redmine trunk (r13333)
  • Ruby 1.8.7-p352/1.9.3-p392/2.0.0-p247/2.1.2
  • CentOS 6/Windows 7

Thanks!


journals

I forgot the following additional procedure, Sorry.

* remove lib/plugins/rfpdf/

--------------------------------------------------------------------------------
Thank you very much, because I looked for working on this I know it's a lot of work. Very nice.

Do you have some way to keep the new code updated compared to TCPDF, like some howto/instructions that could be shared?

Just one thing, the rfpdf name should be definitely removed if the code is no more based upon this deprecated library.
--------------------------------------------------------------------------------
Thank your for the patch. I can confirm that many things work, for example images in a table, unfortunately png images with an alpha channel seem to still be problematic.

We have tried out the patch for one of our customers at "Planio":http://planio, they have png images that currently do not work at all. With the patch, the pdf is rendered with the space for the image, but depending on the pdf viewer it will either show empty space (for example Preview.app on a Mac) or a greyscale distorted version of the png (Chromium on a Mac).

Jun, would it help you to have an image that has the above problems with which you can try it out? I will try to see with our customer if we can generate a problematic png that we can share.
--------------------------------------------------------------------------------
In fact our own logo with an alpha channel shows the same problem. I have attached it to this issue, feel free to use it to test, thanks.
--------------------------------------------------------------------------------
Etienne Massip wrote:

> Do you have some way to keep the new code updated compared to TCPDF, like some howto/instructions that could be shared?

It is the following three that I thought as important.
* Maintain the state of operating.
* Update only the required range.
* A PDF output result should become the same as that of TCPDF.
Therefore, I translated into Ruby, pursuing the repository revision history of TCPDF.

> Just one thing, the rfpdf name should be definitely removed if the code is no more based upon this deprecated library.

OK, I change the rfpdf gem name into another name.
Thank you for the advice.
--------------------------------------------------------------------------------
Felix Schäfer wrote:
> unfortunately png images with an alpha channel seem to still be problematic.

Yes, I agree with you.

> Jun, would it help you to have an image that has the above problems with which you can try it out?

Yes, I'll try it.

--------------------------------------------------------------------------------
I updated patch and gem.

* rfpdf product name and TCPDF class name changed to RBPDF.
* PNG alpha channel image support. (need RMagick.)

h3. Gem file

gem install rbpdf

h3. patch

* lib_redmine.rb_r13333.patch : Gantt/Issues list/Issue/Wiki PDF export patch.
* config_localse_r13333.patch : general_pdf_encoding is set UTF-8 locale.
* remove lib/plugins/rfpdf/

--------------------------------------------------------------------------------
Jun NAITOH wrote:
> I updated patch and gem.

Thanks!

> * PNG alpha channel image support. (need RMagick.)

I cannot confirm, my 2 png test files with alpha channel did not get rendered into the PDF at all. Have you tried it with the file attached to note 4? If the file attached in file 4 gets rendered to PDF for you, I would try to see why it doesn't work for me.
--------------------------------------------------------------------------------
> > * PNG alpha channel image support. (need RMagick.)
>
> I cannot confirm, my 2 png test files with alpha channel did not get rendered into the PDF at all.
> Have you tried it with the file attached to note 4?

Yes. Please show rbpdf_example042.pdf

Please tell me, your environment.
* Ruby version
* OS (Windows/Linux/etc.. )
* RMagick version

my testing environment for this rbpdf_example042.pdf

* CentOS Linux release 6.0 (i386)
* Ruby 1.8.7-p374/ruby-1.9.2-p290/1.9.3-p392/2.0.0-p247/2.1.2
* rmagick 2.13.2

--------------------------------------------------------------------------------
Jun NAITOH wrote:
> Yes. Please show rbpdf_example042.pdf

That looks good indeed. Is this just rbpdf or from a Redmine wiki page? My test was trying to export a PNG with alpha channel transparency included in a wiki page in Redmine, can you confirm this works too for you?

> Please tell me, your environment.
> * Ruby version
> * OS (Windows/Linux/etc.. )
> * RMagick version

ruby 2.1.2p95
OS X 10.9.4
rmagick (2.13.2)
--------------------------------------------------------------------------------
I will try to see where in the Redmine code it fails on my machine.
--------------------------------------------------------------------------------

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

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

--------------------------------------------------------------------------------
I have committed in trunk from r13357 to r13360.

Jun, can you fix #13781?
--------------------------------------------------------------------------------
Toshi MARUYAMA wrote:
> I have committed in trunk from r13357 to r13360.

Thanks!

> Jun, can you fix #13781?

I commented to #13781#note-10
I will solve this problem, if there is a font setting function.

However, the comment of #4787#note-9 worries me.
--------------------------------------------------------------------------------
Jun, I was able to test this a little more and the error I get is caused by an endless loop. The error is:

<pre>
pdf: Image: error: File name too long @ rb_sysopen - /some/path/redmine/tmp/20140903-35375-hkom8b_20140903-35375-hi2xft_20140903-35375-vt1hl5_20140903-35375-11px1pc_20140903-35375-2peiit_201
40903-35375-1qg14l0_20140903-35375-1q2be3d_20140903-35375-1mwkgqu_140731155010_planio_logo_button_250_no_shadow.png.png.png.png.png.png.png.png.png
</pre>

It seems rmagick on my system (OS X 10.9.4, ruby-2.1.2, rmagick-2.13.3, ImageMagick 6.8.9-5 Q16 x86_64 2014-07-25) creates png images with an alpha channel even if it is not needed. The @tempfile_plain@ created in https://github.com/naitoh/rbpdf/blob/1.18.0/lib/rbpdf.rb#L5191-L5204 still has an alpha channel:

<pre>
% identify -format '%[channels]' /some/path/redmine/tmp/20140903-36796-4vbykd_140731155010_planio_logo_button_250_no_shadow.png.png
srgba
</pre>

(the 2 files were from 2 different runs, but you get the idea)

This in turn causes https://github.com/naitoh/rbpdf/blob/1.18.0/lib/rbpdf.rb#L5199 to try to remove the alpha channel again and to go into a loop where @#Image@ will call @#ImagePngAlpha@ and @#ImagePngAlpha@ will call @#Image@.

Is there more information or a test I can do to help you?
--------------------------------------------------------------------------------
Felix Schäfer wrote:
> Jun, I was able to test this a little more and the error I get is caused by an endless loop.

OK, this problem (#note-17 and #note-4) reproduced in my environment. (MAC OS X 10.8.5/ruby 2.1.2/rmagick 2.13.3).

I think that the cause of this problem is RMagick of Mac.

> This in turn causes https://github.com/naitoh/rbpdf/blob/1.18.0/lib/rbpdf.rb#L5199 to try to remove the alpha channel again and to go into a loop where @#Image@ will call @#ImagePngAlpha@ and @#ImagePngAlpha@ will call @#Image@.

Yes.

> Is there more information or a test I can do to help you?

No.
I understood this problem, now.
Thanks!

I will fix this problem in the possible range.
Please wait several days.
--------------------------------------------------------------------------------
Jun NAITOH wrote:
> Felix Schäfer wrote:
> > Jun, I was able to test this a little more and the error I get is caused by an endless loop.
>
> OK, this problem (#note-17 and #note-4) reproduced in my environment. (MAC OS X 10.8.5/ruby 2.1.2/rmagick 2.13.3).
> I understood this problem, now.
> Thanks!

Great to hear!

> Please wait several days.

No pressure, thanks for the hard work on the PDF exports.
--------------------------------------------------------------------------------
I released rbpdf 1.18.1 gem.

#note-17 and #note-4 problem fixed.

Thanks!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Toshi, can we close this one?
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> Toshi, can we close this one?

I think we can close this issue.
But, I don't know why #12934 and #12447 are adhoc in description.
Jun, could you post status in each issues?
--------------------------------------------------------------------------------
h2. Status Update.

h3. main feature

* Use UTF-8 encoding.
* RTL (Right-To-Left) languages support was added.
* HTML tag inside table supported.
* CSS minimum support.
* Bookmark support.
* Adhoc Thai language support. (Bold font not support)
* Image
** 8bit PNG image support without RMagick liblary.
** 16bit PNG image support. (use RMagick liblary)
** Alpha channel PNG image support. (use RMagick liblary)
** JPEG image support. (use RMagick liblary)
** GIF image support. (use RMagick liblary)

h3. fixed issues

* #8753 : RTL languages supoorted.
* #14466 : This patch fixed.
* #13860 : This patch fixed.
* #13589 : default_table_columns parameter is invalid now.
* #14599 : Support 16-bit depth PNG images with RMagick libray.
* #12934 : Support images in tables.
* #14917 : Supported style of center at Table.
* #12447 : Supported PNG alpha channel (by rbpdf 1.18.1)
* #11788 : Supported style of text-align right/center/left attribute. (vertical-align attribute don't support.)

I think we can close this issue, too.

Jun NAITOH wrote:
> h3. fixed issues (adhoc)
>
> #12934 : Supported style of text-align right/center/left attribute, but no vertical-align attribute, yet.

Sorry, I miswrote Issue ID. #12934 is wrong, #11788 is right.
#12934 is already fixed.
And, I think to fixed #11788 , too.

> #12447 : Convert alpha channel to black.

Already fixed by rbpdf 1.18.1

Thanks!
--------------------------------------------------------------------------------
Thank you!
--------------------------------------------------------------------------------
I update Redmine to 2.6.0
PDF Export for Arabic and Persian language was cluttered.
I attached exported files screenshots.
--------------------------------------------------------------------------------
m mahdi wrote:
> I update Redmine to 2.6.0
> PDF Export for Arabic and Persian language was cluttered.
> I attached exported files screenshots.

Duplicate of #10681 and #16040.
--------------------------------------------------------------------------------


related_issues

relates,Closed,13781,CJK(Chinese/Japanese/Korean) characters are not shown in PDF on non CJK locales
relates,Closed,13642,PDF bookmark not displayed when contain a non-ascii character

Admin Redmine さんがほぼ4年前に更新

  • カテゴリPDF export_39 にセット
  • 対象バージョン2.6.0_81 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0