home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / apps / 1511 < prev    next >
Encoding:
Text File  |  1992-11-18  |  1.4 KB  |  51 lines

  1. Newsgroups: comp.windows.x.apps
  2. Path: sparky!uunet!utcsri!skule.ecf!torn!ryelect!elf
  3. From: elf@ee.ryerson.ca (luis fernandes)
  4. Subject: Re: Printing with X
  5. Message-ID: <1992Nov18.174951.15979@ee.ryerson.ca>
  6. Keywords: Printing
  7. Sender: news@ee.ryerson.ca
  8. Nntp-Posting-Host: brundel
  9. Organization: Ryerson Polytechnical Institute, Toronto
  10. References: <1992Nov15.204111.1121@news.columbia.edu>
  11. Distribution: USA
  12. Date: Wed, 18 Nov 1992 17:49:51 GMT
  13. Lines: 36
  14.  
  15. ars@ebony.cc.columbia.edu (Ali R. Siddiqui) writes:
  16. >Hello all,
  17. >
  18. >    I have been writing a program which displays a graph of statistics  
  19. >on the screen now I need to add a print option to it and I was wondering  
  20. >if any of you have had any experience with makeing a hardcopy on a ps  
  21. >printer of the Graph which I am displaying in the window using Xdrawline.
  22. >
  23.  
  24. A quick-and-dirty solution is dumping the window using xwd & xpr
  25. without user interaction.
  26.  
  27. First define a couple of things, the name of the window you wish
  28. to dump & the name of the device to dump to.
  29.  
  30. /* name of the application when iconified & on window*/
  31. #define APPNAME "statsgraph"
  32. /* Postscript LaserWriter*/
  33. #define PRINTERDEVICENAME "lw"
  34.  
  35. Then bind the following function to a key or to a button (via a callback 
  36. mechanism):
  37. void
  38. laser_window()
  39. {
  40. char sysbuf[256];
  41.  
  42.     sprintf(sysbuf,"xwd -name %s | xpr -device %s | lpr -P%s -h", APPNAME,
  43.         PRINTERDEVICENAME, PRINTERDEVICENAME);
  44.  
  45.     system(sysbuf);
  46. }
  47.  
  48.  
  49. --
  50. luis fernandes  <elf@ee.ryerson.ca>
  51.