给你个程序吧
设定纸张大小
Procedure PrintPapersize(Width,Length:integer);
var
Device : array[0..cchDeviceName -1] of Char;
Driver : array[0..(MAX_PATH -1)] of Char;
Port : array[0..32]of Char;
hDMode : THandle;
pDMode : PDevMode;
begin
Printer.GetPrinter(Device,Driver,Port,hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmPaperSize := 256;
pDMode^.dmPaperLength :=Length ;
pDMode^.dmPaperWidth := Width;
pDMode^.dmFields :=pDMode^.dmFields or DM_PAPERSIZE;
pDMode^.dmFields :=pDMode^.dmFields or DM_PAPERLENGTH;
pDMode^.dmFields :=pDMode^.dmFields or DM_PAPERWIDTH;
ResetDC(Printer.Handle,pDMode^);
GlobalUnlock(hDMode);
end;
end;
end;