diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/graphics/gs.rb')
-rw-r--r-- | Master/texmf-dist/scripts/context/ruby/graphics/gs.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb b/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb index 807cad10ccd..2c1079d1a6b 100644 --- a/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb +++ b/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb @@ -13,11 +13,14 @@ require 'base/variables' require 'base/system' +require 'ftools' class GhostScript include Variables + @@pdftrimwhite = 'pdftrimwhite.pl' + @@pstopdfoptions = [ 'AntiAliasColorImages', 'AntiAliasGrayImages', @@ -213,7 +216,7 @@ class GhostScript else report("invalid conversion method #{gsmethod}") end rescue - report("job aborted due to some error #{$!}") + report("job aborted due to some error: #{$!}") begin File.delete(resultfile) if test(?e,resultfile) rescue @@ -338,9 +341,12 @@ class GhostScript end - def convertbounded (inpfile, outfile) - + def convertbounded(inpfile, outfile) report("converting #{inpfile} bounded") + do_convertbounded(inpfile, outfile) + end + + def do_convertbounded(inpfile, outfile) begin return false if FileTest.file?(outfile) && (! File.delete(outfile)) @@ -350,7 +356,7 @@ class GhostScript arguments = '' arguments << "\@gsprofile.ini " - arguments << "-q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH -dSAFER" + arguments << "-q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH -dSAFER " arguments << "#{gscolorswitch} " arguments << "#{gsdefaults} " arguments << "-sOutputFile=#{outfile} #{gsstream} -c quit " @@ -426,7 +432,7 @@ class GhostScript # -dEPSFitPage and -dEPSCrop behave weird (don't work) - arguments = "-sDEVICE=bbox -dSAFER -dNOPAUSE -dBATCH #{inpfile}" + arguments = "-sDEVICE=bbox -dSAFER -dNOPAUSE -dBATCH #{inpfile} " debug("ghostscript: #{arguments}") @@ -456,13 +462,14 @@ class GhostScript report("converting #{inpfile} cropped") - convertbounded(inpfile, @@pdftempfile) + do_convertbounded(inpfile, @@pdftempfile) return unless test(?e,@@pdftempfile) arguments = " --offset=#{@offset} #{@@pdftempfile} #{outfile}" - unless ok = System.run('cropcrap',arguments) then + report("calling #{@@pdftrimwhite}") + unless ok = System.run(@@pdftrimwhite,arguments) then report('cropping failed') begin File.delete(outfile) |