L
lodgue
Unregistered / Unconfirmed
GUEST, unregistred user!
程序设计和运行环境:
1. Win98+Delphi4+打印机(HP LaserJet 6l PCL,可在添加打印机中选择HP公司
然后选择HP LaserJet 6l PCL型号).
2. Win2000上没试过, 公司要求Win98环境.
调试:
调试环境最好试安装上上述类型的打印机.
调试时多打印几下(20下)打开打印队列看看,打印内容的大小,如果大小不一就表示
有一些打印任务中一些内容打印不出来.往往是内容比较小的打印任务.
至于为什么在每次往画布上写时要重新生成TBitmap对象,是因为如果不这样在上述
环境中会出现非法操作.(Win2000中没问题).
var
Bmp:TBitmap;
begin
Button1.Enabled:=False;
Printer.begin
Doc;
//画小条形码1
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(14*7,392*7,114*7,421*7),Bmp);
Bmp.Free;
//画小条形码2
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(123*7,392*7,223*7,421*7),Bmp);
Bmp.Free;
//画小条形码3
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(232*7,392*7,332*7,421*7),Bmp);
Bmp.Free;
//画小条形码4
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(341*7,392*7,441*7,421*7),Bmp);
Bmp.Free;
//画小条形码5
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(450*7,392*7,550*7,421*7),Bmp);
Bmp.Free;
//画小条形码6
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(559*7,392*7,659*7,421*7),Bmp);
Bmp.Free;
//画小条形码1_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(14*7,427*7,114*7,456*7),Bmp);
Bmp.Free;
//画小条形码2_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(123*7,427*7,223*7,456*7),Bmp);
Bmp.Free;
//画小条形码3_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(232*7,427*7,332*7,456*7),Bmp);
Bmp.Free;
//画小条形码4_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(341*7,427*7,441*7,456*7),Bmp);
Bmp.Free;
//画小条形码5_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(450*7,427*7,550*7,456*7),Bmp);
Bmp.Free;
//画小条形码6_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(559*7,427*7,659*7,456*7),Bmp);
Button1.Enabled:=True;
Bmp.Free;
Printer.EndDoc;
end;
1. Win98+Delphi4+打印机(HP LaserJet 6l PCL,可在添加打印机中选择HP公司
然后选择HP LaserJet 6l PCL型号).
2. Win2000上没试过, 公司要求Win98环境.
调试:
调试环境最好试安装上上述类型的打印机.
调试时多打印几下(20下)打开打印队列看看,打印内容的大小,如果大小不一就表示
有一些打印任务中一些内容打印不出来.往往是内容比较小的打印任务.
至于为什么在每次往画布上写时要重新生成TBitmap对象,是因为如果不这样在上述
环境中会出现非法操作.(Win2000中没问题).
var
Bmp:TBitmap;
begin
Button1.Enabled:=False;
Printer.begin
Doc;
//画小条形码1
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(14*7,392*7,114*7,421*7),Bmp);
Bmp.Free;
//画小条形码2
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(123*7,392*7,223*7,421*7),Bmp);
Bmp.Free;
//画小条形码3
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(232*7,392*7,332*7,421*7),Bmp);
Bmp.Free;
//画小条形码4
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(341*7,392*7,441*7,421*7),Bmp);
Bmp.Free;
//画小条形码5
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(450*7,392*7,550*7,421*7),Bmp);
Bmp.Free;
//画小条形码6
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(559*7,392*7,659*7,421*7),Bmp);
Bmp.Free;
//画小条形码1_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(14*7,427*7,114*7,456*7),Bmp);
Bmp.Free;
//画小条形码2_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(123*7,427*7,223*7,456*7),Bmp);
Bmp.Free;
//画小条形码3_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(232*7,427*7,332*7,456*7),Bmp);
Bmp.Free;
//画小条形码4_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(341*7,427*7,441*7,456*7),Bmp);
Bmp.Free;
//画小条形码5_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(450*7,427*7,550*7,456*7),Bmp);
Bmp.Free;
//画小条形码6_
Bmp:=TBitmap.Create;
Bmp.LoadFromFile('BarCode.bmp');
Printer.Canvas.StretchDraw(Rect(559*7,427*7,659*7,456*7),Bmp);
Button1.Enabled:=True;
Bmp.Free;
Printer.EndDoc;
end;