プロジェクト

全般

プロフィール

Vote #80637

完了

PDF thumbnails support on Windows

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

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

0%

予定工数:
category_id:
19
version_id:
155
issue_org_id:
32898
author_id:
4
assigned_to_id:
332
comments:
13
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Redmine 4.1.0 don't support PDF thumbnails on Windows. ( #22481 )
For Windows, "gswin64c(32c).exe"(command line version) can be used instead of "gswin64(32).exe".
By applying this diff, we can detect the presence of Ghostscript on Windows without side effects.


--- org/lib/redmine/thumbnail.rb
+++ patch/lib/redmine/thumbnail.rb
@@ -77,5 +77,6 @@
 
       if Redmine::Platform.mswin?
-        @gs_available = false
+        @gs_available = system("gswin64c -version > nul 2>&1") rescue false
+        @gs_available ||= system("gswin32c -version > nul 2>&1") rescue false
       else
         begin

journals

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

--------------------------------------------------------------------------------
Redmine 4.1.2 will support a new setting @gs_command@ in config/configuration.yml (#33283). You can set the command name such as "gswin64c" and "gswin32c".
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Redmine 4.1.2 will support a new setting @gs_command@ in config/configuration.yml (#33283). You can set the command name such as "gswin64c" and "gswin32c".

I checked this new setting again, please find the result as below.

[Environment]
OS: Windows 10 x64
Redmine:4.2.0
Imagemagick: 6.9.8
Ghostscript: 9.21

[Case 1]
Set gs_command in config/configuration.yml
Result: ImageMagick PDF support available (optional) in Information page is not checked.

[Case 2]
No setting gs_command in config/configuration.yml
But change /lib/redmine/thumbnail.rb with the code "@gs_available = system("gswin64c -version > nul 2>&1") rescue false"
Result: ImageMagick PDF support available (optional) in Information page is checked and convert cmd is working in windows.

So, could you please change the code in /lib/redmine/thumbnail.rb, then the gs_command can also be worked in windows.
If gs_command is set, there is no need to judge operating system environment.

begin
`#{shell_quote GS_BIN} -version`
@gs_available = $?.success?
rescue
@gs_available = false
end

--------------------------------------------------------------------------------
Steve Zhou, thank you for your feedback.

Could you try the attached patch *without* setting imagemagick_convert_command in configuration.yml? I think it should successfully show PDF thumbnails on Windows.

After applying the patch, Redmine will determine whether it should use gswin64c or gswin32c if you are running Redmine on Windows.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Steve Zhou, thank you for your feedback.
>
> Could you try the attached patch *without* setting imagemagick_convert_command in configuration.yml? I think it should successfully show PDF thumbnails on Windows.
>
> After applying the patch, Redmine will determine whether it should use gswin64c or gswin32c if you are running Redmine on Windows.

MAEDA-san, I tested the patch, it can successfully show PDF thumbnails on Windows with setting imagemagick_convert_command and gs_command in configuration.yml.
But without the setting in configuration.yml, (instead, configuring path in environment variables), it cannot show PDF thumbnails.
--------------------------------------------------------------------------------
Steve Zhou wrote:
> MAEDA-san, I tested the patch, it can successfully show PDF thumbnails on Windows with setting imagemagick_convert_command and gs_command in configuration.yml.
> But without the setting in configuration.yml, (instead, configuring path in environment variables), it cannot show PDF thumbnails.

Zhou先生, thank you for testing the patch.

As you wrote, now I understood that rejecting Windows is not necessary. I will try to make it possible to display PDF thumbnails on Windows in a near future release.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Steve Zhou wrote:
> > MAEDA-san, I tested the patch, it can successfully show PDF thumbnails on Windows with setting imagemagick_convert_command and gs_command in configuration.yml.
> > But without the setting in configuration.yml, (instead, configuring path in environment variables), it cannot show PDF thumbnails.
>
> Zhou先生, thank you for testing the patch.
>
> As you wrote, now I understood that rejecting Windows is not necessary. I will try to make it possible to display PDF thumbnails on Windows in a near future release.

Well noted with thanks.
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Removed the code for 32bit Windows from the patch.

I think there are very few people running Redmine on 32bit Windows now, so there is little need to add a method that checks for 32bit Windows to lib/redmine/platform.rb.

If you are using the 32bit version of gswin32c.exe, you can still generate PDF thumbnails by setting gs_command in configuration.yml.
--------------------------------------------------------------------------------
Committed the patch. Thank you all for your contribution.
--------------------------------------------------------------------------------


related_issues

relates,Closed,22481,Show thumbnails for PDF attachments
relates,Closed,33283,Thumbnail support for PDF attachments may not be detected

Admin Redmine さんが3年以上前に更新

  • カテゴリAttachments_19 にセット
  • 対象バージョン5.0.0_155 にセット

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

いいね!0
いいね!0