home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / PSUTILS / FIXWFWPS.PL < prev    next >
Perl Script  |  1993-11-09  |  794b  |  34 lines

  1. #!@PERL@
  2. # fixwfwps: fix Word for windows PostScript for printing.
  3.  
  4. # feed this into perl
  5. eval 'exec perl -S $0 "$@"'
  6.    if $running_under_some_shell;
  7.  
  8. $nesting = 0;
  9. while (<>) {
  10.    tr/\000-\010\012-\014\016-\037//d;
  11.    foreach (grep($_ ne "", split("\015"))) {
  12.       s!/SVDoc\s+save\s+def!!g;
  13.       s!SVDoc\s+restore!!g;
  14.       if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) {
  15.      print "$1\n";
  16.      $wfwepsf = 1;
  17.       } elsif (/^SS\s*$/ && $wfwepsf) {
  18.      print "%%Page: $wfwepsf $wfwepsf\n";
  19.      $wfwepsf++;
  20.      print "$_\n";
  21.       } elsif (/^%MSEPS Preamble/) {
  22.      print "%%BeginDocument: (Included EPSF)\n";
  23.      print "$_\n";
  24.      $nesting++;
  25.       } elsif (/^%MSEPS Trailer/) {
  26.      $nesting--;
  27.      print "$_\n";
  28.      print "%%EndDocument\n";
  29.       } elsif (! /^%%BoundingBox/) {
  30.      print "$_\n";
  31.       }
  32.    }
  33. }
  34.