To Rick

To Rick

Postby FranciscoA » 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: Select all  Expand view
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
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: To Rick

Postby Rick Lipkin » Tue Feb 05, 2019 3: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
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Rick

Postby FranciscoA » Tue Feb 05, 2019 6:13 pm

Rick.
Thanks for your reply. I'll do some tests.
Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: To Rick

Postby FranciscoA » Thu Feb 07, 2019 4: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
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: To Rick

Postby Rick Lipkin » Fri Feb 08, 2019 4:48 pm

Francisco

Thank you for the feedback .. you are welcome

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Horizon and 50 guests