[REBOL] Re: Using a printer in Windows
From: al:bri:xtra at: 9-Jan-2002 9:19
Philippe wrote:
> I want to know if it's possible to user a printer from a rebol program ?
Try something like this:
REBOL [
Name: 'Printer
Title: "Printer"
File: %"Printer.r"
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 27/Sep/2001
Example: [
Printer "This goes to the printer!"
Printer/Page "This prints this line and feeds a page!"
]
]
Printer: func [
"Sends text to printer on //prn."
[catch]
Text [string!] "The text to be printed."
/Page "Append Carriage Return (CR) and Page Feed."
][
throw-on-error [
secure [
%//prn [allow write]
]
write %//prn Text
if Page [write/binary %//prn "^(0D)^(page)"]
Text
]
]
]
It works OK on Windows PCs. For other computers, you might have to change
the %//PRN to something else.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/