FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Rick
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
To Rick
Posted: Mon Feb 04, 2019 11:37 PM
Hi Rick.
Is this code still working for you, on any printer?
I not be able to obtain the same look on other printers.
Thanks.

Spanish:
Hola rick
¿Este código sigue funcionando para usted en cualquier impresora?
No puedo obtener el mismo aspecto en otras impresoras.
Gracias.

The example takes advantage of the horizontal and vertical properties of the print driver to allow the output to resolve and look ( almost ) identical on any printer.

Code (fw): Select all Collapse
oFont8b   := TFont():New( "Times New Roman", 0,-8, .F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont10   := TFont():New( "Times New Roman", 0,-10,.F.,.F. , , , ,.F.,,,,,,, oPRINT, )
oFont10b  := TFont():New( "Times New Roman", 0,-10,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont12ib := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.T.,,,,,,, oPRINT, )
oFont12b  := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont14b  := TFont():New( "Times New Roman", 0,-14,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont24b  := TFont():New( "Times New Roman", 0,-24,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )

DEFINE FONT oFont10d  NAME "Courier New" SIZE 0,-10 of oPRINT
DEFINE PEN oPen1 WIDTH 5 //10

nLines    := 0
nPages    := 1

nRowStep := oPrint:nVertRes() / 55      // pixel per line = 57.65 @ 55
nColStep := oPrint:nHorzRes() /130      // columns

oPRINT:StartPage()

nMargin := Int(oPrint:nLogPixelX()*0.5)      // *0.2
LINE    := nMargin
nPage   := 1


...
...

// company
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cOwner, oFONT14b )
Line += oFont8b:nHeight
Line += oFont10b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cDivision , oFONT12b )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.69),cInvoiceType, oFONT12b )
Line += oFont10b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cAdd1 , oFONT12b )

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.69),"INVOICE", oFONT24b )
Line += oFont10b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cAdd2 , oFONT12b )
Line += oFont10b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), alltrim(cCity)+", "+cState+" "+cZip, oFONT12b )
Line += oFont12b:nHeight
Line -= oFont8b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.69),cRepairNumber, oFONT14b )

Line += oFont24b:nHeight
Line += oFont24b:nHeight
Line += oFont8b:nHeight

Line += oFont12b:nHeight
Line += oFont12b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cCustName, oFONT12b  )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.69),"Cust Id     :", oFONT10b )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.79),cCustomerId, oFONT10 )
Line += oFont12b:nHeight

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cCustAdd1, oFONT12b  )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.69),"Bill Date   :", oFONT10b ) // 775
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.79),dtoc( dInvDate ), oFONT10 )
Line += oFont12b:nHeight

...
...
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: To Rick
Posted: Tue Feb 05, 2019 03:43 PM

Francisco

Yes .. I am still using this code in my programs today ...

oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.07), cOwner, oFONT14b ) .. the oPrint:nHorzRes() is the calculation derived from the oPrint object which is your defined printer.

This calculation allows the printed content to be placed on the page at the same ( visual ) co-ordinates regardless if the printer .. laserjet, deskjet ...

Rick Lipkin

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: To Rick
Posted: Tue Feb 05, 2019 06:13 PM

Rick.
Thanks for your reply. I'll do some tests.
Regards.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: To Rick
Posted: Thu Feb 07, 2019 04:25 PM

Hi Rick.
I did tests on different printers and it works fine.
Thanks.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: To Rick
Posted: Fri Feb 08, 2019 04:48 PM

Francisco

Thank you for the feedback .. you are welcome

Rick Lipkin

Continue the discussion