diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/tetex/Makefile.am | 1 | ||||
-rw-r--r-- | Build/source/texk/tetex/Makefile.in | 1 | ||||
-rw-r--r-- | Build/source/texk/tetex/epstopdf.man | 61 | ||||
-rwxr-xr-x | Build/source/utils/epstopdf/epstopdf.pl | 112 |
4 files changed, 112 insertions, 63 deletions
diff --git a/Build/source/texk/tetex/Makefile.am b/Build/source/texk/tetex/Makefile.am index 97c088d2ad3..dcea815de03 100644 --- a/Build/source/texk/tetex/Makefile.am +++ b/Build/source/texk/tetex/Makefile.am @@ -45,7 +45,6 @@ dist_man1_MANS = \ dvi2fax.man \ dvired.man \ e2pall.man \ - epstopdf.man \ fmtutil.man \ fontinst.man \ kpsetool.man \ diff --git a/Build/source/texk/tetex/Makefile.in b/Build/source/texk/tetex/Makefile.in index 959b2bdd1c9..7d122212bbd 100644 --- a/Build/source/texk/tetex/Makefile.in +++ b/Build/source/texk/tetex/Makefile.in @@ -226,7 +226,6 @@ dist_man1_MANS = \ dvi2fax.man \ dvired.man \ e2pall.man \ - epstopdf.man \ fmtutil.man \ fontinst.man \ kpsetool.man \ diff --git a/Build/source/texk/tetex/epstopdf.man b/Build/source/texk/tetex/epstopdf.man deleted file mode 100644 index ca7c16b9018..00000000000 --- a/Build/source/texk/tetex/epstopdf.man +++ /dev/null @@ -1,61 +0,0 @@ -.TH EPSTOPDF 1 "4 March 2008" -.\" man page originally by Jim Van Zandt -.SH NAME -epstopdf \- convert an EPS file to PDF -.SH SYNOPSIS -\fBepstopdf\fP [\fIoptions\fP] \fIepsfile\fP -.SH DESCRIPTION -\fBepstopdf\fP transforms the Encapsulated PostScript file -\fIepsfile\fP so that it is guaranteed to start at the 0,0 coordinate, -and it sets a page size exactly corresponding to the BoundingBox. -This means that when Ghostscript renders it, the result needs no -cropping, and the PDF MediaBox is correct. The result is piped to -Ghostscript and a PDF version written. -.P -If the bounding box is not right, of course, you have problems. -.SH OPTIONS -.IP "\fB--outfile\fP=\fIfile\fP" -write result to \fIfile\fP instead of standard output. -.IP "\fB--\fP[\fBno\fP]\fBfilter\fP" -read standard input (default: --nofilter). -.IP "\fB--\fP[\fBno\fP]\fBgs\fP" -run ghostscript (default: --gs). -.IP "\fB--\fP[\fBno\fP]\fBcompress\fP" -use compression (default: --compress). -.IP "\fB--\fP[\fBno\fP]\fBhires\fP" -scan HiresBoundingBox (default: --nohires). -.IP "\fB--\fP[\fBno\fP]\fBexact\fP" -scan ExactBoundingBox (default: --noexact). -.IP "\fB--\fP[\fBno\fP]\fBdebug\fP" -debug informations (default: --nodebug). -.IP "\fB--help\fP -print usage -.SH EXAMPLE -Examples for producing "test.pdf": -.nf - -epstopdf test.eps -produce postscript | epstopdf --filter >test.pdf -produce postscript | epstopdf -f -d -o=test.pdf - -.fi -Example: look for HiresBoundingBox and produce corrected PostScript: -.nf - -epstopdf -d --nogs -hires test.ps>testcorr.ps -.fi -.SH BUGS -The case of "%%BoundingBox: (atend)" is not supported. -.PP -Please send reports regarding the program or this man page -to tex-k@tug.org. -.SH SEE ALSO -\fBgs\fP(1). -.SH AUTHOR -The script was originally written by Sebastian Rahtz, for Elsevier -Science, with subsequent contributions from many others. Currently -maintained by Gerben Wierda. -.PP -Man page originally written by Jim Van Zandt. -.PP -You may freely use, modify and/or distribute this file. diff --git a/Build/source/utils/epstopdf/epstopdf.pl b/Build/source/utils/epstopdf/epstopdf.pl new file mode 100755 index 00000000000..e6032218622 --- /dev/null +++ b/Build/source/utils/epstopdf/epstopdf.pl @@ -0,0 +1,112 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' + if 0; + +# Change by Thomas Esser, Sept. 1998: The above lines allows us to find +# perl along $PATH rather than guessing a fixed location. The above +# construction should work with most shells. + +# A script to transform an EPS file so that: +# a) it is guarenteed to start at the 0,0 coordinate +# b) it sets a page size exactly corresponding to the BoundingBox +# This means that when Ghostscript renders it, the result needs no +# cropping, and the PDF MediaBox is correct. +# c) the result is piped to Ghostscript and a PDF version written +# +# It needs a Level 2 PS interpreter. +# If the bounding box is not right, of course, you have problems... +# +# The only thing I have not allowed for is the case of +# "%%BoundingBox: (atend)", which is more complicated. +# +# Sebastian Rahtz, for Elsevier Science +# +# now with extra tricks from Hans Hagen's texutil. +# +use Getopt::Long ; +$filedate="1998/10/22"; +$fileversion="2.4"; +if ($^O eq 'MSWin32') { $GS="gswin32c";} +else { $GS="gs"; } + +$opt_debug=0; +$opt_compress=1; +$opt_gs=1; +$opt_outfile=""; +$result = GetOptions ( + "debug!", + "compress!", + "gs!", + "outfile=s", +); +$Filename=$ARGV[0]; +if (!$opt_compress) + { $GSOPTS="-dUseFlateCompression=false " ;} +else + { $GSOPTS=""; } + +open(TMP,"<$Filename") or die "Usage: epstopdf <filename>"; +binmode TMP; +$_=$Filename; +s/\.[A-Za-z]*$//; +if ($opt_gs) { + open(OUT,"| $GS -q -sDEVICE=pdfwrite $GSOPTS -sOutputFile=$_.pdf - -c quit") + or die "cannot open Ghostscript for piped input"; + if ($opt_debug) { print STDERR "read $Filename, write $_.pdf\n"; } +} +else + { + if ($opt_outfile ne "") + { open(OUT,">$opt_outfile") or die "cannot write $opt_outfile" ; + if ($opt_debug) { print STDERR "read $Filename, write $opt_outfile\n"; } + } + else { open(OUT,">&STDOUT"); } +} + +$bbneeded=1; +local $bbpatt="[0-9\.\-]"; +local $bbxpatt = "[0-9eE\.\-]"; +while (<TMP>) { +# +# throw away binary junk before %!PS +# + if (/%!PS/) + { s/(.*)%!PS/%!PS/o ; + print OUT; } +# +# locate BoundingBox +# + elsif ( /%%BoundingBox: (atend)/) { + $bbneeded = 0; + print OUT; + } + elsif (/%%BoundingBox:\s*($bbpatt+)\s+($bbpatt+)\s+($bbpatt+)\s+($bbpatt+)/ ) + { +# only read the *first* bounding box + if ($bbneeded) { + if ($opt_debug) { print STDERR "old BB is $1 $2 $3 $4\n";} + + $width = $3 - $1; + $height = $4 - $2; + $xoffset = 0 - $1; + $yoffset = 0 - $2; + if ($opt_debug) { + print STDERR "new BB is 0 0 $width $height, offset $xoffset $yoffset\n"; + } + print OUT "%%BoundingBox: 0 0 $width $height\n"; + print OUT "<< /PageSize [$width $height] >> setpagedevice\n"; + print OUT "gsave $xoffset $yoffset translate\n"; + $bbneeded=0; + } + +# else ignore that embedded BoundingBox anyway + } + elsif (/%%(HiResB|ExactB)oundingBox:\s*($bbxpatt+)\s+($bbxpatt+)\s+($bbxpatt+)\s+($bbxpatt+)/ ) { + print STDERR "Unused hires/exact bounding box $_\n"; + } +else + { print OUT; } +} +close(TMP); +print OUT "grestore\n"; +close(OUT); +; |