用winapi 的方法:
添好一行到STRING 中;printstring(s:string);
再用prnlf(no:cardinal);
换行(NO:换行数);
直到所有行打完
//----------------------------------回车、换行-------
procedure prnlf(no:cardinal);
var i:cardinal;
begin
for i:=1 to nodo
begin
printstring(chr(13));
printstring(chr(10));
end;
end;
//----------------------------------
procedure printstring(s:string);
type
tdocinfor=record
pdocname
char;
poutputfile
char;
pdatatype
char;
end;
var handle:Thandle;
N
WORD;
do
cInfo1:TDOCINFOR;
prtname:string;
begin
prtname:= printer.Printers[printer.printerIndex];
if not openPrinter(pchar(prtname),handle,nil) then
begin
showmessage('打印机错误:'+INTTOstr(getlasterror));
exit;
end;
withdo
cinfo1do
begin
pdocname:=pchar('testdo
c');
poutputfile:=nil;
pdatatype:='RAW';
end;
startdocprinter(handle,1, @docinfo1);
startpageprinter(handle);
writeprinter(handle,pchar(s),length(s),N);
endpageprinter(handle);
enddocprinter(handle);
closeprinter(handle);
end;