其实这只是类似与银行系统的打印而已!不知道哪位有作过!我的纸张设置代码如下,可是不行, procedure TRepBoKuanTongZhi.SetPaperHeight(Value: integer); var device: array[0..255] of char; driver: array[0..255] of char; port: array[0..255] of char; hdmode: thandle; PDMode: PDEVMODE; begin //自定义纸张高度127mm value:=92; printer.PrinterIndex:=printer.PrinterIndex; printer.GetPrinter(device,driver,port,hdmode); if hDMode <> 0 then begin pDMode := GlobalLock(hDMode); if pDMode <> nil then begin pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or DM_PAPERLENGTH; pDMode^.dmPaperSize := DMPAPER_USER; pDMode^.dmPaperLength := Value * 10; pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL; pDMode^.dmDefaultSource := DMBIN_MANUAL; GlobalUnlock(hDMode); end; end; Printer.PrinterIndex := Printer.PrinterIndex; end;
epson的lq-670k是不是比较宽的可以卡纸的老式打印机? 好象可以设定不自动换页
在 windows 下控制打印机是一件头疼的事啊。
to make11111(可可) 我已经写了设置纸张大小的程序可是不行, 上面我已经写过一个,我还用了如下的一个程序,还是不行procedure TForm1.Button1Click(Sender: TObject); var Device : array[0..255] of char; Driver : array[0..255] of char; Port : array[0..255] of char; hDMode : THandle; PDMode : PDEVMODE; begin Printer.PrinterIndex := Printer.PrinterIndex; Printer.GetPrinter(Device, Driver, Port, hDMode); if hDMode <> 0 then begin pDMode := GlobalLock(hDMode); if pDMode <> nil then begin {Set to legal} pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize; pDMode^.dmPaperSize := DMPAPER_LEGAL; {Set to custom size} pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or DM_PAPERWIDTH or DM_PAPERLENGTH; pDMode^.dmPaperSize := DMPAPER_USER; pDMode^.dmPaperWidth := 100 {SomeValueInTenthsOfAMillimeter}; pDMode^.dmPaperLength := 100 {SomeValueInTenthsOfAMillimeter}; {Set the bin to use} pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL; pDMode^.dmDefaultSource := DMBIN_MANUAL; GlobalUnlock(hDMode); end; end; Printer.PrinterIndex := Printer.PrinterIndex; end;
xxx.height 是用mm做单位的
使用自定义的报表长度的,只要你设定了
report属性中的page height
而且os中打印机的纸张设定自定义就可以了
我的操作系统是NT5的也就是win2000的
请问该如何设置纸张大小?
可是我的打印机属性里却没有纸张自定义的属性,只有规定的几个页面格式
procedure TRepBoKuanTongZhi.SetPaperHeight(Value: integer);
var
device: array[0..255] of char;
driver: array[0..255] of char;
port: array[0..255] of char;
hdmode: thandle;
PDMode: PDEVMODE;
begin
//自定义纸张高度127mm
value:=92;
printer.PrinterIndex:=printer.PrinterIndex;
printer.GetPrinter(device,driver,port,hdmode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperLength := Value * 10;
pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
好象可以设定不自动换页
上面我已经写过一个,我还用了如下的一个程序,还是不行procedure TForm1.Button1Click(Sender: TObject);
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
{Set to legal}
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
pDMode^.dmPaperSize := DMPAPER_LEGAL; {Set to custom size}
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE or
DM_PAPERWIDTH or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperWidth := 100 {SomeValueInTenthsOfAMillimeter};
pDMode^.dmPaperLength := 100 {SomeValueInTenthsOfAMillimeter};
{Set the bin to use}
pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;