HP Laser Jet 1006 을 구입하여 출력을 하니까 좌측여백이 중앙에서 시작되어 찍히네요. 그래서 HP 고객센터에 전화를 했더니 소스에서 수정을 해야 한다네요. 호스트 베이직인가 뭔가 하면서.... 아직 실력이 미천해서 어쩔도리없이 도움을 청합니다
[참고] 프린터 소스 입니다. 도와주세요.
procedure TMainForm.BitBtn6Click(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;
fs,i1,Ypoint,Xpoint,Length_CHK,Ypoint1:integer;
Prt_Total,pt_amount:string;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then begin {사용자 정의 용지로 바꾸는 예}
pDMode^.dmOrientation := DMORIENT_PORTRAIT;
pDMode^.dmFields := pDMode^.dmFields or
DM_ORIENTATION or
DM_PAPERSIZE or
DM_PAPERWIDTH or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperWidth := 212; {단위는 mm}
pDMode^.dmPaperLength := 220; {단위는 mm} //202
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
With search do begin // 접수증을 읽는다
DatabaseName:='Dryclean';
Close;
SQL.clear;
SQL.ADD('select *');
SQL.ADD('from JUPSU');
SQL.ADD('Where Y_NUM = :A ');//
SQL.ADD('order BY J_NUM');//
ParamByName('A').asstring:=Prt_Yeong;
if Prepared = false then Prepare;
search.open;
if search.recordcount = 0 then exit;
HD_Title_01:= '접수일: '+ Formatdatetime('YYYY-MM-DD',now);//접수일
HD_Title_02:= Edit2.text +' 님'+ '( '+Edit4.text+ '-' +Edit5.text+' )';//성명
if Prt_Total_Baedal <> '' then
HD_Title_03:= Edit3.text + ' '+ Edit6.text//전화번호
else
HD_Title_03:= Edit3.text;//전화번호
HD_Title_04:= Edit7.text;//주소
HD_Title_05:= '바 른 세 탁 TEL : 304-5866';//상호.전화번호
// HD_Title_05:= '바 른 세 탁 TEL: 889-3497';//상호.전화번호
printer.canvas.font.Name:='굴림체';
printer.canvas.font.Size:=11;
printer.canvas.font.Style:=[];
printer.canvas.TextOut(100,320,HD_Title_01);
printer.canvas.TextOut(100,3025,HD_Title_01); //2500
printer.canvas.TextOut(100,415,HD_Title_02);
printer.canvas.TextOut(100,3120,HD_Title_02);//2590
printer.canvas.TextOut(100,540,HD_Title_03);
printer.canvas.TextOut(100,3245,HD_Title_03);//2745
printer.canvas.TextOut(100,680,HD_Title_04);
printer.canvas.TextOut(100,3385,HD_Title_04);//2865
printer.canvas.TextOut(100,1720,HD_Title_05);
printer.canvas.TextOut(100,4445,HD_Title_05);//3865
printer.canvas.font.Size:=9;
fs:=printer.canvas.font.Size*10;
Ypoint:=330;
Ypoint1:=Ypoint + 2705;//2155
for i1 := 1 to search.RecordCount do begin //페이지 시작부터 끝까지
if (i1 = 16) or (i1 = 31) or (i1 = 46) then begin
Printer.NewPage; //시작현재이지와 현재페이지가 다르면 새로운페이지
Ypoint:=330;
Ypoint1:=Ypoint + 2705;//2175
search.RecNo:=i1;
printer.canvas.TextOut(1800,Ypoint,search.Fieldbyname('J_NUM').asstring);
printer.canvas.TextOut(1800,Ypoint1,search.Fieldbyname('J_NUM').asstring);
printer.canvas.TextOut(2250,Ypoint,search.Fieldbyname('ITEM').asstring);
printer.canvas.TextOut(2250,Ypoint1,search.Fieldbyname('ITEM').asstring);
printer.canvas.TextOut(3250,Ypoint,search.Fieldbyname('COLOR').asstring);
printer.canvas.TextOut(3250,Ypoint1,search.Fieldbyname('COLOR').asstring);
Length_CHK:=Length(search.FieldByName('Amount').Asstring);
case Length_CHK of
1:begin Xpoint:=3750+91 end;
2:begin Xpoint:=3750+78 end;
3:begin Xpoint:=3750+65 end;
4:begin Xpoint:=3750+39 end;
5:begin Xpoint:=3750+26 end;
else
Xpoint:=3750+13
end;
pt_amount:=FormatFloat('#,##',search.FieldByName('Amount').Asinteger);
printer.canvas.TextOut(Xpoint,Ypoint,pt_amount);
printer.canvas.TextOut(Xpoint,Ypoint1,pt_amount);
printer.canvas.TextOut(4200,Ypoint,search.Fieldbyname('IN_Date').asstring);
printer.canvas.TextOut(4200,Ypoint1,search.Fieldbyname('IN_Date').asstring);
Ypoint:=Ypoint+fs;
Ypoint1:=Ypoint+2705;
end
else begin
search.RecNo:=i1;
printer.canvas.TextOut(1800,Ypoint,search.Fieldbyname('J_NUM').asstring);
printer.canvas.TextOut(1800,Ypoint1,search.Fieldbyname('J_NUM').asstring);
printer.canvas.TextOut(2250,Ypoint,search.Fieldbyname('ITEM').asstring);
printer.canvas.TextOut(2250,Ypoint1,search.Fieldbyname('ITEM').asstring);
printer.canvas.TextOut(3250,Ypoint,search.Fieldbyname('COLOR').asstring);
printer.canvas.TextOut(3250,Ypoint1,search.Fieldbyname('COLOR').asstring);
Length_CHK:=Length(search.FieldByName('Amount').Asstring);
case Length_CHK of
1:begin Xpoint:=3750+91 end;
2:begin Xpoint:=3750+78 end;
3:begin Xpoint:=3750+65 end;
4:begin Xpoint:=3750+39 end;
5:begin Xpoint:=3750+26 end;
else
Xpoint:=3750+13
end;
pt_amount:=FormatFloat('#,##',search.FieldByName('Amount').Asinteger);
printer.canvas.TextOut(Xpoint,Ypoint,pt_amount);
printer.canvas.TextOut(Xpoint,Ypoint1,pt_amount);
printer.canvas.TextOut(4200,Ypoint,search.Fieldbyname('IN_Date').asstring);
printer.canvas.TextOut(4200,Ypoint1,search.Fieldbyname('IN_Date').asstring);
Ypoint:=Ypoint+fs;
Ypoint1:=Ypoint+2705;
end;
end;
search.close;
search.unprepare;
end;
if Prt_Amount = 0 then
Prt_Total:=Prt_EA + ' 건 ' +'0 원' + Prt_Total_Kubun
else begin
pt_amount:=FormatFloat('#,##',Prt_Amount);
Prt_Total:= Prt_EA + ' 건 '+ pt_amount +Prt_Total_Kubun;
end;
if Prt_Total_Baedal <> '' then
Prt_Total:=Prt_Total+' 배달';
if Prt_Total_keup <> '' then
Prt_Total:=Prt_Total+' [급]';
printer.canvas.font.Size:=12;
printer.canvas.TextOut(2000,1820,Prt_Total);
printer.canvas.TextOut(2000,4515,Prt_Total);
printer.canvas.font.Size:=9;
Printer.EndDoc;
Printer.EndDoc;//인쇄끝
search.close;
search.unprepare;