home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / mswindo / programm / win32 / 639 < prev    next >
Encoding:
Text File  |  1992-08-20  |  2.6 KB  |  103 lines

  1. Path: sparky!uunet!stanford.edu!rutgers!uwvax!galtee.cs.wisc.edu!rose
  2. From: rose@galtee.cs.wisc.edu (Scott Rose)
  3. Newsgroups: comp.os.ms-windows.programmer.win32
  4. Subject: Re: I too have unable to print the PS files
  5. Message-ID: <1992Aug20.212702.19182@cs.wisc.edu>
  6. Date: 20 Aug 92 21:27:02 GMT
  7. References: <1992Aug10.180051.3140@titan.ksc.nasa.gov> <1992Aug20.063746.12690@microsoft.com> <1992Aug20.195819.18866@pony.Ingres.COM>
  8. Sender: news@cs.wisc.edu (The News)
  9. Organization: University of Wisconsin, Madison -- Computer Sciences Dept.
  10. Lines: 91
  11.  
  12. In article <1992Aug20.195819.18866@pony.Ingres.COM> rion@Ingres.COM  writes:
  13.  
  14. >I have been able to print some of the docs, but with some problems.
  15. >
  16. >The tools manual is broken into some 20 or so files (corresponding to
  17. >chapters), but the Win32 API manuals are in two files around 2.5MB each!!
  18. >My postscript printer can print these just fine, but the print spool area is
  19. >limited to approx 1 MB, so the API manuals get truncated down to 372 pages.
  20. >
  21. >Does anyone know how to break up postscript files?
  22.  
  23. I was able to get this to work by simply editing out all the code following
  24. the first showpage command and the showpage command associated with the page
  25. preceeding the first page I wanted.  You do print the first page on each print
  26. run, but that might be cheaper than figuring out where the definitions end and
  27. the first page begin.
  28.  
  29. Here is a gawk script that helps.  Usage is 
  30.  
  31.     <scriptname> -v page=<pagenumber>
  32.  
  33. E.g.
  34.  
  35.     frompage -v page=272
  36.  
  37. #!/usr/local/gawk -f
  38. BEGIN {
  39.   foundFirst = 0;
  40.   foundPage = 0;
  41.   foundPageEnd = 0;
  42.   if(page == 0) {
  43.     print("usage");
  44.     exit;
  45.   }
  46.   pagePattern = sprintf("(page %d", page);
  47.   if(debug)
  48.     print("pattern = " pagePattern);
  49. }
  50. {
  51.   if(!foundFirst) {
  52.  
  53.     # haven't seen the first showpage yet
  54.  
  55.     if(i = index($0, "showpage")) {
  56.  
  57.       # here it is; print the prefix of the string including it
  58.  
  59.       foundFirst = 1;
  60.       print(substr($0, 1, i+length("showpage")));
  61.     }
  62.     else {
  63.  
  64.       # always print lines that preceed the first showpage
  65.  
  66.       print($0);
  67.     }
  68.   }
  69.   else {
  70.  
  71.     # HAVE seen the first "showpage"
  72.  
  73.     if(!foundPage) {
  74.  
  75.       # look for the line that indicates that we are on the start-after page
  76.  
  77.       if(index($0, pagePattern))
  78.         foundPage = 1;
  79.     }
  80.     if(foundPage) {
  81.  
  82.       # HAVE seen our start-after page
  83.  
  84.       if(!foundPageEnd) {
  85.  
  86.         # look for the next "showpage"
  87.  
  88.         if(i = index($0, "showpage")) {
  89.  
  90.           # found it; everything following is printed
  91.  
  92.       foundPageEnd = 1;
  93.       if(length($0) > i + length("showpage"))
  94.         print(substr($0, i+length("showpage")));
  95.         }
  96.       }
  97.       else {
  98.     print($0);
  99.       }
  100.     }
  101.   }
  102. }
  103.