X
xiezhaohui
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是测试的全部源代码,在执行时如果用EpsonLQ-1600K,打印位置正常,但是如果
换成 HpLaserJet6L-Pro激光机,打印结果错位,10cm(Y轴)左右时,能扩大2mm,X轴也错位
换用EsponVP-1850,也有错位。请各位大虾指点。
procedure TForm1.Button1Click(Sender: TObject);
var
px,py:int64;
begin
printer.begin
Doc;
px:=GETDEVICECAPS(PRINTER.HANDLE,LOGPIXELSX);
py:=GETDEVICECAPS(PRINTER.HANDLE,LOGPIXELSY);
px:=round(px/2.54);
py:=round(py/2.54);
printer.canvas.textout(round(0.5*px),round(0.5*py),'this is (5mm,5mm)-----------------------------------');
printer.canvas.textout(round(0.5*px),round(10.5*py),'this is (5mm,105mm)');
printer.canvas.textout(round(0.5*px),round(20.5*py),'this is (5mm,205mm)');
printer.canvas.textout(round(10.0*px),round(20.5*py),'this is (100mm,205mm)');
printer.EndDoc;
end;
附:
打印机的参数:(不知道这些参数有没有用)
Epson 1600k HP Laserjet
LOGPIXELSX 180 600
LOGPIXELSY 180 600
HORZRES 1488 4690
VERTRES 2104 7014
PHYSICALWIDTH 1488 4676
PHYSICALHEIGHT 2104 6814
PHYSICALOFFSETX 0 100
PHYSICALOFFSETY 0 142
换成 HpLaserJet6L-Pro激光机,打印结果错位,10cm(Y轴)左右时,能扩大2mm,X轴也错位
换用EsponVP-1850,也有错位。请各位大虾指点。
procedure TForm1.Button1Click(Sender: TObject);
var
px,py:int64;
begin
printer.begin
Doc;
px:=GETDEVICECAPS(PRINTER.HANDLE,LOGPIXELSX);
py:=GETDEVICECAPS(PRINTER.HANDLE,LOGPIXELSY);
px:=round(px/2.54);
py:=round(py/2.54);
printer.canvas.textout(round(0.5*px),round(0.5*py),'this is (5mm,5mm)-----------------------------------');
printer.canvas.textout(round(0.5*px),round(10.5*py),'this is (5mm,105mm)');
printer.canvas.textout(round(0.5*px),round(20.5*py),'this is (5mm,205mm)');
printer.canvas.textout(round(10.0*px),round(20.5*py),'this is (100mm,205mm)');
printer.EndDoc;
end;
附:
打印机的参数:(不知道这些参数有没有用)
Epson 1600k HP Laserjet
LOGPIXELSX 180 600
LOGPIXELSY 180 600
HORZRES 1488 4690
VERTRES 2104 7014
PHYSICALWIDTH 1488 4676
PHYSICALHEIGHT 2104 6814
PHYSICALOFFSETX 0 100
PHYSICALOFFSETY 0 142