2005-07-14

第一个任务:打印

我和一个朋友共同参与SFB 600的tcl编程工作。我们的第一个任务是在现有的程序基础上添加打印功能,能打印文字和图表和表格。
我们的想法是把当前显示的内容转换为postscript文件,然后把这个临时生成的ps文件送到打印机。
TK的canvas有个命令选项是postscript可以把当前显示的内容dump成一个文件,发送到打印机可以用windows自带的lpr命令。


proc drucken {} {
puts stderr "Drucke Postscript canvas.ps"
set fd [open canvas.ps w]
puts $fd [.c postscript ]
close $fd
}
bind . drucken


lpr的用法:

Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d] filename

Options:
-S server Name or ipaddress of the host providing lpd service
-P printer Name of the print queue
-C class Job classification for use on the burst page
-J job Job name to print on the burst page
-o option Indicates type of the file (by default assumes a text file) Use "-o l" for binary (e.g. postscript) files
-x Compatibility with SunOS 4.1.x and prior
-d Send data file first

没有评论:

发表评论