summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
committerKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
commit3c85b55e2f245fb7edac7e445f107e6d0bb423ae (patch)
treec62b7f80edafe0455310d08e09f4218127bf9e87 /Master/texmf-dist/scripts/context/ruby/graphics/gs.rb
parente5ecff27a26ef59e1dbe9702677687fd7107be3a (diff)
context update
git-svn-id: svn://tug.org/texlive/trunk@2444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/graphics/gs.rb')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/graphics/gs.rb21
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)