diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-07-23 10:38:37 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-07-23 10:38:37 +0000 |
commit | 3ebbde8f3ab397ac0234e652368bd8cbfee47354 (patch) | |
tree | bc9885720b030131d9677309e8795cc8d127c746 /Master/texmf-dist/scripts/epspdf | |
parent | 17a1fa90e832ffafc1639159203cfcef616033f4 (diff) |
Epspdf::pdf_to_eps header fix for some versions of pdftops
git-svn-id: svn://tug.org/texlive/trunk@9720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/epspdf')
-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 |