Var
PDevice,PDriver,pPort:Array[0..255] of Char;
hDMode:THandle;
PDMode
DeviceMode;
begin
Printer.GetPrinter(pDevice,pDriver,pPort,hDMode);
if hDMode=0 then
begin
Printer.PrinterIndex :=Printer.PrinterIndex ;
Printer.GetPrinter(pDevice,pDriver,pPort,hDMode);
end;
if hDMode<>0 then
begin
PDMode:=GlobalLock(hDMode);
if PDMode<>Nil then
with PDMode^do
begin
DMFields:=DMFields Or DM_PAPERLENGTH;
dmPaperLength:=1276;
dmFields:=dmFields or DM_PAPERWIDTH;
dmPaperWidth:=2000;
//设置打印机纸张的宽、高
end;
GlobalUnLock(hDMode);
Printer.PrinterIndex :=Printer.PrinterIndex ;
end;
Printer.Canvas.font.name:='宋体';
Printer.Canvas.font.size:=11;
Printer.begin
Doc;
..............//打印的内容
Printer.EndDoc;
end;