FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Using the Printer Object
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM

Using the Printer Object

Posted: Mon Aug 26, 2013 04:12 AM

I have been playing with producing a form in FiveWin.
I use the following for conversion from Pixel's to Inches.

nWidth := 1280
nHeight := 200

oPrn:Pix2Inch( @nHeight,@nWidth )
oPrn:Inch2Pix( @nHeight,@nWidth )

nWidth does not equal 1280
nHeight does not equal 200

Should it?
Is this correct?

Thanks,

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using the Printer Object

Posted: Mon Aug 26, 2013 02:45 PM
Byron,

I have tested your code this way:
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local nWidth := 1280
   local nHeight := 200
   local oPrn

   PRINTER oPrn

   oPrn:Pix2Inch( @nHeight, @nWidth )
   MsgInfo( nHeight, Str( nWidth ) )

   oPrn:Inch2Pix( @nHeight, @nWidth )
   MsgInfo( nHeight, Str( nWidth ) )

   ENDPRINTER

return nil

And on the first MsgInfo() I get 0,333333 and 2.13, and at the second MsgInfo() I get 200,007183 and 1280,10 which are quite aproximated to 200 and 1280 (the original values) and understanding that there are no "decimals" of pixels, then we could round them to 200 and 1280
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM

Re: Using the Printer Object

Posted: Mon Aug 26, 2013 04:02 PM

Antonio,

Thanks for taking the time to look at this.

With the same code:

I get on the first MsgInfo 2.13, and .3333 as well, but when I go back I get 1182, and 99.95,
It seems the second method subtracts the ::nXoffset, and ::nYoffset, on my printer they equal 100.

When adding a new method McsInch2Pix which eliminates the ::nXoffset, and ::nYoffset I get the following:
First MsgInfo 2.13, and .3333 again, and 1282.68, and 199.95 on the second.
I assume the're a little different because your printer is different than mine.

Is this the problem, my version has the nXoffset, and nYoffset?

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Using the Printer Object

Posted: Mon Aug 26, 2013 05:43 PM

Byron,

Instead of implementing new methods, you could set ::nXoffset and ::nYoffset to zero:

PRINTER oPrn

oPrn:nXoffset = 0
oPrn:nYoffset = 0
oPrn:Pix2Inch( @nHeight, @nWidth )
...

I am using the default printer on Win8. No printers installed on this pc.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion