summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-09-12 12:01:08 -0600
committerGitHub <noreply@github.com>2022-09-12 12:01:08 -0600
commitedc2ea29d0d8e5e33615fa4e0757f933fad11f41 (patch)
treeab50a2571c89ffeeebdf5fb65d098f4026c5c89e /lib
parent9d317ad9b213a0562402ff3994534bf4ccbd1d6c (diff)
resolves #2337 honor GS_OPTIONS environment variable in RGhost optimizer (PR #2338)
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/pdf/optimizer/rghost.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/asciidoctor/pdf/optimizer/rghost.rb b/lib/asciidoctor/pdf/optimizer/rghost.rb
index e86366e1..feea3efe 100644
--- a/lib/asciidoctor/pdf/optimizer/rghost.rb
+++ b/lib/asciidoctor/pdf/optimizer/rghost.rb
@@ -29,6 +29,8 @@ end)
module Asciidoctor
module PDF
class Optimizer::RGhost < Optimizer::Base
+ DEFAULT_PARAMS = %w(gs -dNOPAUSE -dBATCH -dQUIET -dNOPAGEPROMPT)
+
# see https://www.ghostscript.com/doc/current/VectorDevices.htm#PSPDF_IN for details
(QUALITY_NAMES = {
'default' => :default,
@@ -43,6 +45,11 @@ module Asciidoctor
if (gs_path = ::ENV['GS'])
::RGhost::Config::GS[:path] = gs_path
end
+ default_params = DEFAULT_PARAMS.drop 0
+ if (user_params = ::ENV['GS_OPTIONS'])
+ (default_params += user_params.split).uniq!
+ end
+ ::RGhost::Config::GS[:default_params] = default_params
end
def optimize_file target