From 1eef335097c79cb54c5c15a91477891c8a5e9332 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Wed, 27 Jan 2010 13:56:13 +0000 Subject: Epspdf updated to 0.4.3 git-svn-id: svn://tug.org/texlive/trunk@16843 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/epspdf/epspdf.help | 30 ++++++++--------- Master/texmf-dist/scripts/epspdf/epspdf.rb | 49 ++++++++++++++++++++-------- Master/texmf-dist/scripts/epspdf/epspdfrc.rb | 43 ++++++++++++++---------- Master/texmf-dist/scripts/epspdf/epspdftk.rb | 2 +- 4 files changed, 76 insertions(+), 48 deletions(-) (limited to 'Master/texmf-dist/scripts/epspdf') diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.help b/Master/texmf-dist/scripts/epspdf/epspdf.help index 1fac2734fa8..6a5687aed69 100644 --- a/Master/texmf-dist/scripts/epspdf/epspdf.help +++ b/Master/texmf-dist/scripts/epspdf/epspdf.help @@ -1,9 +1,9 @@ Epspdf and epsdftk ****************** -This manual is for epspdf, version 0.4.2. +This manual is for epspdf, version 0.4.3. -Copyright (C) 2006, 2007, 2008, 2009 Siep Kroonenberg. +Copyright (C) 2006, 2008, 2009, 2010 Siep Kroonenberg. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided @@ -49,9 +49,10 @@ for the current file. ====================== Grayscaling: Simple color figures can be converted to grayscale. -Bitmapped data won't be converted. If grayscaling doesn't work on +Bitmapped data won't be converted. If grayscaling doesn't work even on non-bitmapped data, select the "Try harder to grayscale" option. This -may cause an extra pdf-PostScript roundtrip. +may cause an extra pdf-PostScript roundtrip, but grayscaling may still +fail. Compute tight boundingbox: This option is only available if a single page is converted. @@ -85,7 +86,7 @@ preserved between sessions. 1.5.1 Configuring viewers ------------------------- -Under Linux, the preferred PostScript- and pdf viewers can be configured +Under Unix, the preferred PostScript- and pdf viewers can be configured in this screen. Epspdf looks for a number of PostScript- and pdf viewers, from which you can select one, but you can also enter one manually. @@ -142,7 +143,7 @@ epspdftk.rb. It is strongly recommended to invoke epspdf.rb via a wrapper script epspdf or epspdf.bat on the search path, e.g. #!/bin/sh - PATH_TO_EPSPDF/epspdf.rb "@" + PATH_TO_EPSPDF/epspdf.rb "$@" for Unix/Linux/OS X, or "PATH_TO_RUBY.EXE" "PATH_TO_EPSPDF.RB" %* for Windows. It is the responsibility of the caller to provide double @@ -157,15 +158,16 @@ Basic usage: 2.1 Option summary ================== -The summary below is the output of a command `epspdf --help' for help. +Typing `epspdf --help' gives you the following summary: $ epspdf --help - Epspdf version 0.4.2 - Copyright (C) 2006, 2008, 2009 Siep Kroonenberg - Epspdf 0.4.2 + Epspdf version 0.4.3 + Copyright (C) 2006, 2008, 2009, 2010 Siep Kroonenberg Convert between [e]ps and pdf formats Usage: epspdf.rb [options] infile [outfile] + Default for outfile is file.pdf if infile is file.eps or file.ps Default for outfile is file.eps if infile is file.pdf + -g, --gray, --grey Convert to grayscale; success not guaranteed -G, --GRAY, --GREY Try harder to convert to grayscale @@ -190,6 +192,7 @@ The summary below is the output of a command `epspdf --help' for help. -i, --info Info: display detected filetype -s Save (some) settings -d Debug: don't remove temp files + -v Prints version info -h, --help Show this message @@ -207,8 +210,7 @@ screenshots, but less so for diagrams and spreadsheet-generated graphics. A file in PostScript- or pdf format can contain both types of graphic -data, e.g. a text in vector format agains a photographic background in -bitmapped format. +data. Vector graphics can be freely scaled without losing sharpness or becoming pixellated. If bitmapped graphics are enlarged too much, @@ -339,10 +341,8 @@ grayscale image. It produces larger files than sam2p. -------------------------------- Create a batchfile `bitmap2eps.bat' with contents - sam2p "%~1" "%~dpn1.eps" (TeX Live) or - bmeps -c "%~1" "%~dpn1.eps" (MikTeX) and place it _e.g._ on your desktop. Now if you drop a bitmapped graphic on this batchfile then you will get an eps file with @@ -420,7 +420,7 @@ dmensions of the pdf file. Other conversions preserve or generate a hires boundingbox. Under Windows, the new version looks for an installed TeX and will use -its private Ghostscript if it cannot find separately installed +its private Ghostscript if it cannot find a separately installed Ghostscript. TeX Live's pdftops, being on the searchpath, will be used unless epspdf finds another copy first. 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 diff --git a/Master/texmf-dist/scripts/epspdf/epspdfrc.rb b/Master/texmf-dist/scripts/epspdf/epspdfrc.rb index d9751ff970f..08bcfdb991a 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdfrc.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdfrc.rb @@ -1,10 +1,10 @@ -EPVERSION = '0.4.2' -COPYRIGHT = '2006, 2008, 2009' +EPVERSION = '0.4.3' +COPYRIGHT = '2006, 2008, 2009, 2010' # epspdf conversion utility, configuration module ##### -# 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. @@ -88,33 +88,33 @@ def shell_error_string ( e ) returl nil else return case e - when 0: "Out of memory or resources" + when 0 then "Out of memory or resources" #define ERROR_FILE_NOT_FOUND 2L #define SE_ERR_FNF 2 - when 2: "File not found" + when 2 then "File not found" #define ERROR_PATH_NOT_FOUND 3L #define SE_ERR_PNF 3 - when 3: "Path not found" + when 3 then "Path not found" #define SE_ERR_ACCESSDENIED 5 - when 5: "Access denied" + when 5 then "Access denied" #define SE_ERR_OOM 8 - when 8: "Not enough memory" + when 8 then "Not enough memory" #define ERROR_BAD_FORMAT 11L - when 11: "Invalid exe" + when 11 then "Invalid exe" #define SE_ERR_SHARE 26 - when 26: "Sharing violation" + when 26 then "Sharing violation" #define SE_ERR_ASSOCINCOMPLETE 27 - when 27: "Invalid file association" + when 27 then "Invalid file association" #define SE_ERR_DDETIMEOUT 28 - when 28: "DDE timeout" + when 28 then "DDE timeout" #define SE_ERR_DDEFAIL 29 - when 29: "DDE fail" + when 29 then "DDE fail" #define SE_ERR_DDEBUSY 30 - when 30: "DDE busy" + when 30 then "DDE busy" #define SE_ERR_NOASSOC 31 - when 31: "No file association" + when 31 then "No file association" #define SE_ERR_DLLNOTFOUND 32 - when 32: "DLL not found" + when 32 then "DLL not found" else "Unspecified error" end # case end # else @@ -393,6 +393,10 @@ class << $settings # ghostscript. TeX may also come with pdftops.exe, but pdftops # would then be on the searchpath and not require special treatment. + # Later versions of Ghostscript come with several libraries built-in. + # Hopefully, there is no harm in including too many directories + # in GS_LIB. Better test this. + texbindir = ( ARCH == 'w32' ) ? find_on_path( 'tex' ) : nil texbindir = short_name( File.dirname( texbindir ) ) if texbindir @@ -448,8 +452,11 @@ class << $settings gsroot = texroot + '/tlpkg/tlgs' this_gs_prog = gsroot + '/bin/gswin32c.exe' if test( ?f, this_gs_prog ) - self.gs_prog = this_gs_prog - ENV['GS_LIB'] = "#{gsroot}/lib;#{gsroot}/fonts;#{gsroot}/Resource" + self.gs_prog = this_gs_prog + ENV['GS_LIB'] = "#{gsroot}/lib;#{gsroot}/fonts" + if test( ?d, "#{gsroot}/Resource" ) + ENV['GS_LIB'] += ";#{gsroot}/Resource" + end else # test for MikTeX hidden ghostscript # http://blog.miktex.org/post/2005/04/ # Starting-mgsexe-at-the-DOS-Prompt.aspx diff --git a/Master/texmf-dist/scripts/epspdf/epspdftk.rb b/Master/texmf-dist/scripts/epspdf/epspdftk.rb index 79dbdd5d325..44ad3a2c063 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdftk.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdftk.rb @@ -3,7 +3,7 @@ # epspdf conversion utility, GUI frontend ##### -# 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. -- cgit v1.2.3