Font height when printing
I can't seem to get this right...When i print a document, the lines overlap:
Code:
if((pDC = CreateDC("WINSPOOL", achPrinter, 0, 0))){//OK
//A4: W=21000, H=29700
ZeroMemory(&dInf, sizeof(DOCINFO));
dInf.cbSize = sizeof(DOCINFO);
dInf.lpszDocName = "PrtTest";
if(SetTextAlign(pDC, TA_LEFT|TA_TOP)==GDI_ERROR) GetErr("SetTextAlign");
if(StartDoc(pDC, &dInf)<=0) GetErr("StartDoc");
if(StartPage(pDC)<=0) GetErr("StartPage");
if((hFont = GetCurrentObject(pDC,OBJ_FONT))){
if(GetObject(hFont,sizeof(LOGFONT),&lf)){
lpHeight = GetDeviceCaps(pDC,VERTRES),//get height of page
lpWidth = GetDeviceCaps(pDC,HORZRES),//and its width too
lfH = lf.lfHeight;
lfW = lf.lfWidth;
}else
GetErr("GetObject(hFont,sizeof(LOGFONT),&lf)");
}else
GetErr("GetCurrentObject(pd.hDC,OBJ_FONT)");
// Kundeinfo
if(rs.GetData("navn", p1, 50)) TextOut(pDC, 10*lfW, 2*lfH, p1, strlen(p1));
if(rs.GetData("adresse1", p1, 50))TextOut(pDC, 10*lfW, 3*lfH, p1, strlen(p1));
if(rs.GetData("round", p1, 50)) TextOut(pDC, 1000, 3*lfH, p1, strlen(p1));
if(rs.GetData("pnr", p1, 50)) TextOut(pDC, 10*lfW, 4*lfH, p1, strlen(p1));
if(rs.GetData("psted", p1, 50)) TextOut(pDC, 500, 4*lfH, p1, strlen(p1));
if(rs.GetData("kunnr", p1, 50)) TextOut(pDC, 800, 5*lfH, p1, strlen(p1));
if(rs.GetData("round", p1, 50)) TextOut(pDC, 1000, 5*lfH, p1, strlen(p1));
//
if(EndPage(pDC)<=0) GetErr("EndPage");
if(EndDoc(pDC)<=0) GetErr("EndDoc");
DeleteDC(pDC);
b(hwThis, "Dokument sendt til printer", "Test", MB_ICONINFORMATION);
}else
GetErr("CMD_PRINT->GetDC()");