Windows的打印机制是按页面进行处理的。
如果正确设置了纸张的长度,某些驱动程序是不会自动按页走纸的。
如果正确设置了纸张的长度,某些驱动程序是不会自动按页走纸的。
解决方案 »
- wsock API编写文件传输遇到的问题(大家来看看)
- 字体对话框一问!
- 很简单的问题--3/4的分数都给你,信誉担保!!!!!!
- 释放窗体就会出错。
- 我搜集的几十个常用的VCL组件(包),谁要的话与我联系巴!
- 界面制作
- TSQLQuery查询集中有DATETIME类型字段时不能用TDataSetProvider提取数据集?
- 关于、《Delphi 5 开发人员指南》
- 用ADO的ltBatchOptimistic方式,批更新,如何知道现在有多少数据未提交?
- 转让一本书<Delphi5开发人员手册>
- 好汉!上酒,问天下英雄,“Windows自定义纸张如何由程序实现?”
- 功能复杂DBGrid转到QuickReport打印//zswang
assignprn(prntext); //将PRNTEST分配给打印机
rewrite(prntext);//调用REWRITE函数,为输出打开已分配的文件而要用图形方式,textout打印即可完美控制
Printer.Canvas.TextOut
By using the Windows API Escape() function, your application can pass data direc
tly to the printer. If the printer driver supports the PASSTHROUGH printer escape
, you can use the Escape() function and the PASSTHROUGH printer escape to send na
tive printer language codes to the printer driver.
If the printer driver does not support the PASSTHROUGH printer escape, you must
use the DeviceCapabilities() and ExtDevMode() functions instead.
Mit der Windows API Funktion Escape() kann man Daten direkt zum Drucker schicken
.
Wenn der Drucker Treiber dies nicht unterst黷zt, m黶sen die DeviceCapabilities()
and ExtDevMode() Funktionen verwendet werden.// DOS like printing using Passthrough command
// you should use "printer.begindoc" and "printer.enddoc"Type
TPrnBuffRec=Record
bufflength:Word;
Buff_1:array[0..255] of Char;
End;//Function DirectToPrinter(S:String;NextLine:Boolean):Boolean;
var Buff:TPrnBuffRec;
TestInt:Integer;
Begin
TestInt:=PassThrough;
if Escape(Printer.Handle,QUERYESCSUPPORT,SIZEOF(TESTINT),@testint,nil) > 0 Then
Begin
if NextLine Then S:=S+#13+#10;
StrPCopy(Buff.Buff_1,S);
Buff.bufflength:=StrLen(Buff.Buff_1);
Escape(Printer.Canvas.Handle,Passthrough,0,@buff,nil);
Result:=True;
End
Else
Result:=False;
end;
// this code works if the printer supports escape commands
// you can get special esc codes from printer's manual {example:
printer.begindoc;
try
directoprinter('This text ');
finally
printer.enddoc;
end;
}
我要打印票据的。7个孔的:)
with printer do begin
try
//printer.PageHeight;
//printer.PageWidth;
我想在上两行设置,不行。怎么办?
BeginDoc;
Canvas.Font.Name:='宋体';
Canvas.Font.Size:=12;
Canvas.Font.Style:=[fsBold];
Canvas.TextOut(160,0,XKZ);
Canvas.TextOut(320,0,YZH);
NewPage;
finally
EndDoc;