var devs;pdevmode;
devsp
ointer;
devsize:integer;
printobject:thandle;
devname:string;
begin
printerobject:=printer.handle;
devname:=tprinterdev(printer.printers.object[printer.printer]).device;
devsize:=documentproperties(0,printerobject,pchar(devname),devs,devs,0);
devsp:=allocmem(devsize);
try
do
cumentproperties(0,printerobject,pchar(devname),devsp,nil,dm_out_buffer);
devs:=devsp;
devs^.dmfields:=dm_papersize ordmpaperlength or dm_paperwidth;
devs^.dmpapersize:=0;
devs^.dmpapaerlength:=//你要的长度
devs^.dmpaperwidth:=//
do
cumentproperties(0,printerobject,pchar(devname),devsp,devsp,dm_out_buffer or dm_in_buffer);
finally
freemem(devsp,devsize);
end;
end;