Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: How to print a document

From: brian:hawley at: 12-Jun-2001 17:04

Hi all! Thorsten Moeller wrote:
>i ran into the same problem as Francois a while ago. OK, Rebol is a >messaging language per definition, but that should not exclude printing in >all environments. I was *NOT* able to get the %//prn stuff to work for me as >i don't have an local attached printer. I only have network-printer at my >service, but they didn't care about any printing command from my W2K box at >all. So what can i do?
When you setup the network printer mapping on your Win* box, it will ask you if you want to print from MS-DOS programs. Say yes. It will then map the printer to a MS-DOS special port file, like LPT2 or some such, rather than one of the unnamed ports that it will attach to if you say no. Then look in the properties for that printer, on the Ports page, and check which port the printer is attached to. You can write to that port as a file after that. If there is a printer port on your computer then that port will not likely be LPT1 (the one with the PRN alias). Example code: write %lpt2 "Hello World!" Keep in mind that if you want to do more than text output you will have to write in the printer language, usually some HP variant or Postscript. You might find it easier to write Postscript even if your printer doesn't support it - in that case you should use Ghostscript and have it create a virtual printer port to listen to and handle. Tricky, but perhaps easier than generating HP printer codes. Good luck! Brian Hawley P.S.:
>write %//prn "Hello, World!"
The // is not necessary. If your printer is attached to LPT1 (the port with the PRN alias), %prn will do.