---------- X-Sun-Data-Type: text X-Sun-Data-Description: text X-Sun-Data-Name: text X-Sun-Charset: us-ascii X-Sun-Content-Lines: 29 Hi all, most of the answer points me to use ghostscript, it include programs that should be able to do this for me, some of you also send me the program (ps2eps). You can find ghostscript via archie. I also got a program (in pearl) from Andy Feldt to check for EPS conformity in a PostScript file. It is included as a attachment. /Joakim Hartikainen Thanks to, andrea@varano.ing.unico.it (Andrea Zuccollo) bernards@ECN.NL (Marcel Bernards) Szemethy Tivadar Joerg Sprengel Corey Satten SEYMOUR@LEPTON.NPL.WASHINGTON.EDU Mark Allyn Norbert Olligschlaeger ew@senate-ncd-server.senate.be (Emmanuel Willems) (John Hearns - System Manager)" Per Foreby annr@reference.collins.co.uk (Ann Rautenbach Luis Miguel Silveira Nico Garcia raoul@mit.edu Andy_Feldt@phyast.nhn.uoknor.edu (Andy Feldt)o) ---------- X-Sun-Data-Type: default-app X-Sun-Data-Name: epscheck X-Sun-Charset: us-ascii X-Sun-Content-Lines: 158 #!/usr/local/bin/perl # # this script checks a file for any of the operators forbidden by # the Encapsulated PostScript standard (version 2.0) # it also checks for the minimum conforming comments # # Written (in a hurry) by Andy Feldt # December 16, 1994, Department of Physics & Astronomy, Univ. of Oklahoma # It is not pretty, but it works for my needs! # # Usage: epscheck file1 [file2 ...] # if ($#ARGV < 0) { print "Enter file name: "; chop($ARGV[0]=); } @files = @ARGV; @words = (grestoreall,erasepage,nulldevice,exitserver,initgraphics,copypage, renderbands,initmatrix,banddevice,setpageparams, initclip,framedevice,note,setscreen,settransfer); $delims = "[][}{)(><\/ \n]"; # # now build the search based on similar code in the man page for perl # $search = 'while (<>) { study;'; foreach $word (@words) { $tag = "_".$word; $search .= "++\$seen{\$ARGV\.$tag} if /\${delims}$word\${delims}/;\n"; } $search .= "}"; @ARGV = @files; undef $/; # # and here is where the actual search for the words is done # eval $search; # this screams $/ = "\n"; # put back to normal input delim # # now check for the %!PS header and the %%BoundingBox line # foreach $file (@files) { if ( ! open(IN,"<$file") ) {warn("Could not open $file");} else { $flag = 0; $line = ; if ($line !~ /^%!PS-Adobe-.*EPSF-/ ) {$flag = 1;} $flag += 2; $lines = 0; while ( (($line = ) =~ /^%/) || $lines++ < 10 ) { if ($line =~ /^%%BoundingBox:/) {$flag -= 2; last;} } close(IN); } $flags{$file} = $flag; } # # here we fill the $opers array with a list of invalid operators found # the keys are the file names # foreach $filetag (keys(%seen)) { (@parts) = split("_",$filetag); $oper = pop @parts ; $file = join("_",@parts); $opers{$file} .= ",".$oper; } # # ok, now print out the errors and warnings, start with bad operators, # then add setscreen and settransfer, then do the header stuff # foreach $file (sort keys(%opers)) { $oper = $opers{$file}; $oper =~ s/,//; $maybe = ""; if ($oper =~ /setscreen/) { $oper =~ s/setscreen//; $maybe = "setscreen"; $oper =~ s/^,//; $oper =~ s/,$//; $oper =~ s/,,/,/; } if ($oper =~ /settransfer/) { $oper =~ s/settransfer//; $maybe .= ",settransfer"; $oper =~ s/^,//; $oper =~ s/,$//; $oper =~ s/,,/,/; } $maybe =~ s/^,//; if ($oper) { print "\n"; print "$file is NOT valid EPS. The following are NOT allowed operators:\n"; print " $oper\n"; if ($maybe) { print " In addition, the following operators have restricted use:\n"; print " $maybe\n"; } } elsif ($maybe) { print "\n"; print "$file MIGHT not be valid EPS. The following\noperators can be"; print " a problem sometimes:\n"; print " $maybe\n"; } if ($flags{$file} > 0) { if ( $flags{$file} == 1 || $flags{$file} == 3 ) { print " The file is also missing a valid first line which"; print " should look like:\n"; print "%!PS-Adobe-v.v EPSF-v.v\n"; } if ( $flags{$file} > 1 ) { print " The file is also missing a %%BoundingBox: line.\n"; } } } $numok = 0; foreach $file (@files) { if ($opers{$file} eq "") { if ($flags{$file} > 0) { $also = ""; $filetag = "\n".$file; if ( $flags{$file} == 1 || $flags{$file} == 3 ) { print "\n$file is missing a valid first line which"; print " should look like:\n"; print "%!PS-Adobe-v.v EPSF-v.v\n"; $also = " also"; $filetag = "It"; } if ( $flags{$file} > 1 ) { print "$filetag is$also missing a %%BoundingBox: line.\n"; } print "\n"; } else { $numok++; } } } if ($numok > 0) { print "The following files APPEAR to be correct, Encapsulated PostScript:\n"; foreach $file (@files) { if ($opers{$file} eq "" && $flags{$file} == 0) { print "$file\n"; } } print "\n"; }