diff options
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf-dist/scripts/epspdf/epspdf.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.rb b/Master/texmf-dist/scripts/epspdf/epspdf.rb index fb391b6dde6..632ae6d1541 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdf.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdf.rb @@ -684,7 +684,7 @@ class PsPdf if $settings.pdftops_prog and $settings.use_pdftops cmd = "\"#{$settings.pdftops_prog}\"" + " #{PsPdf.ps_options( sep )}" + - " -eps -f #{page} -l #{page}" + + " -paper match -eps -f #{page} -l #{page}" + " \"#{@path}\" \"#{retVal.path}\"" else cmd = "\"#{$settings.gs_prog}\" -sDEVICE=epswrite" + @@ -696,6 +696,25 @@ class PsPdf write_log cmd # if $DEBUG fail EPSystemError, cmd unless \ system( cmd ) and test( ?s, retVal.path ) +# fix for incorrect DSC header produced by some versions of pdftops: +# if necessary, change line `% Produced by ...' into `%%Produced by ...' +# otherwise the DSC header would be terminated before the bbox comment +# this bug has been reported, but not yet acted upon. +# match first 500 chars against `% Produced by' + fhead = '' + File.open( retVal.path, $R ) do |fl| + fhead = fl.read( 500 ) + end # File + if fhead.match( /[\r\n]% Produced by/ ) + newpath = mktemp( 'eps' ) + write_log "pdftops header fix #{retVal.path} => #{newpath}" + File.open( newpath, $W ) do |fl2| + fl2.write( fhead.sub( /([\r\n])(% Produced by)/, '\1%%Produced by' ) ) + end + sliceFile( retVal.path, newpath, File.size( retVal.path ) - 500, 500, $A ) + retVal.path = newpath + end +# end fix for incorrect DSC header produced by some versions of pdftops retVal.atfront = 1 retVal.find_bb_simple return retVal |