diff options
Diffstat (limited to 'Master/texmf-dist/scripts/epspdf/epspdf.rb')
-rwxr-xr-x | Master/texmf-dist/scripts/epspdf/epspdf.rb | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.rb b/Master/texmf-dist/scripts/epspdf/epspdf.rb index 0b47db2c505..6c67f7eae3f 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdf.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdf.rb @@ -3,7 +3,7 @@ # epspdf conversion utility, main source ##### -# Copyright (C) 2006, 2008, 2009 Siep Kroonenberg +# Copyright (C) 2006, 2008, 2009, 2010 Siep Kroonenberg # n dot s dot kroonenberg at rug dot nl # # This program is free software, licensed under the GNU GPL, >=2.0. @@ -987,6 +987,8 @@ class PsPdf def any_to_any( params={} ) + # $stderr.puts( hash_prn( params ) ) + type = params[ 'type' ] page = params[ 'page' ] bbox = params[ 'bbox' ] @@ -1090,13 +1092,11 @@ class PsPdf when 'pdf' if bbox - pp = pp.ps_to_pdf( 'sep' => gray ) - pp = pp.pdf_to_eps( 'page' => page ) + pp = pp.ps_to_pdf.pdf_to_eps( 'sep' => gray, 'page' => page ) pp = pp.fix_bb return pp = pp.eps_to_pdf( 'gray' => gray ) elsif page - pp = pp.ps_to_pdf( 'sep' => gray ) - pp = pp.pdf_to_ps( 'page' => page ) + pp = pp.ps_to_pdf.pdf_to_ps( 'sep' => gray, 'page' => page ) return pp = pp.ps_to_pdf( 'gray' => gray ) else pp = pp.ps_to_pdf.pdf_to_ps( 'sep' => 1 ) if gRAY @@ -1145,8 +1145,7 @@ save_settings = false opts = OptionParser.new do |opts| # for help output - opts.banner = "Epspdf 0.4.2" - opts.separator "Convert between [e]ps and pdf formats" + opts.banner = "Convert between [e]ps and pdf formats" opts.separator "Usage: epspdf.rb [options] infile [outfile]" opts.separator "" opts.separator "Default for outfile is file.pdf" + @@ -1202,9 +1201,18 @@ opts = OptionParser.new do |opts| opts.on( "-V PDFVERSION", "--version=PDFVERSION", PDF_VERSIONS, "Deprecated; use `-N' or `--pdfversion'." ) do |opt| + if opt == "" + puts EPVERSION + exit + end $settings.pdf_version = opt end + #opts.on( "--version" ) do |opt| + # puts EPVERSION + # exit + #end + opts.on( "-I", "Ignore pdftops even if available", "(default: use if available)" ) do |opt| @@ -1260,21 +1268,34 @@ opts = OptionParser.new do |opts| end end # opts +# hack alert! we support `--version' for version info although +# --version is still interpreted as desired pdf output version + +if ARGV.length == 1 and ARGV[0] == '--version' + puts EPVERSION + exit +end + # parse options destructively -opts.parse!( ARGV ) +begin + opts.parse!( ARGV ) +rescue OptionParser::ParseError => e + STDERR.puts e.message, "\n", opts + exit( -1 ) +end $options.page = 1 if $options.bbox and not $options.page $settings.write_settings if save_settings if ARGV.length < 1 - puts opts if not save_settings # help output - # puts "Settings:" - # $settings.each_key do |k| - # puts "key #{k} value #{$settings[k].val}" - # end - abort + if not save_settings # help output + puts opts + abort + else + exit + end elsif $options.info puts "File type of #{ARGV[0]} is #{PsPdf.new( 'file' => ARGV[0] ).type}" exit |