Absolute measurements when printing - please help.. 
Author Message
 Absolute measurements when printing - please help..

Hi People,

I vaguely remember reading a post a few weeks ago from somebody with the
same problem.

I urgently need to setup a "Cheque Run" application (ie print cheques onto
pre-printed stationery).

The stationery is A4 sized and will be produced on a laserjet printer.

Having done this type of thing in the past, I have noticed that what may
line up on one printer - does not in fact line up on another.

Is there a way I can specify that if, for example, I need to print at :-

25mm in from the left hand edge of the page and
120mm down from the top

...that it will print in this exact position regardless of the printer I am
using ????

Thanks in advance

Steve Butler
http://www.*-*-*.com/



Mon, 21 May 2001 03:00:00 GMT  
 Absolute measurements when printing - please help..
Hi!

I think this is what you're looking for:

Global Const PHYSICALOFFSETX = 112
Global Const PHYSICALOFFSETY = 113

Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal
nIndex As Long) As Long

Sub GetPrinterMarginsInTwips(ByRef XOffset As Long, ByRef YOffset As
Long)

    XOffset = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETX)
    XOffset = XOffset * Printer.TwipsPerPixelX
    YOffset = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETY)
    YOffset = YOffset * Printer.TwipsPerPixelY

End Sub

One centimer is approximatly 567 twips, so if you want to print 25 mm
from the left and 120 mm down then you can do like this:

Dim X as Long
Dim Y as Long
GetPrinterMarginsInTwips X, Y
Printer.CurrentX = 2.5 * 567 - X
Printer.CurrentY = 12 * 567 - Y

I hope this will help.

P-O

Steve Butler skrev:

Quote:

> Hi People,

> I vaguely remember reading a post a few weeks ago from somebody with the
> same problem.

> I urgently need to setup a "Cheque Run" application (ie print cheques onto
> pre-printed stationery).

> The stationery is A4 sized and will be produced on a laserjet printer.

> Having done this type of thing in the past, I have noticed that what may
> line up on one printer - does not in fact line up on another.

> Is there a way I can specify that if, for example, I need to print at :-

> 25mm in from the left hand edge of the page and
> 120mm down from the top

> ...that it will print in this exact position regardless of the printer I am
> using ????

> Thanks in advance

> Steve Butler
> http://nt1.pncl.co.uk/sbutler



Mon, 21 May 2001 03:00:00 GMT  
 Absolute measurements when printing - please help..

Quote:

> Is there a way I can specify that if, for example, I need to print at :-

> 25mm in from the left hand edge of the page and
> 120mm down from the top

> ....that it will print in this exact position regardless of the printer I am
> using ????

Hi,

Use 'GetDeviceCaps' to check 'PhysicalOffsetX' and 'PhysicalOffsetY'
These values are in pixel. With 'printer.scale' you can easily convert
pixel -> mm

If you then shift the printer's system of coordinates you don't even
have to change your original program.

  offsetxMM=7 'for example
  offsetyMM=5 'for example
  printer.scalemode=6 'MM
  heightMM=printer.scaleheight
  widthMM=printer.scalewidth

  printer.scale ( offsetxMM, offsetyMM),(widthMM+offsetxMM,heightMM+offsetyMM)

  '.... your programm

HTH

Michaela



Mon, 21 May 2001 03:00:00 GMT  
 Absolute measurements when printing - please help..
Per / Michaela.

That was it !!  - "GetDeviceCaps" - I couldn't remember it for the life of
me!

Thanks also to Jim Deutch who responded personally !

Steve

Quote:


>> Is there a way I can specify that if, for example, I need to print at :-

>> 25mm in from the left hand edge of the page and
>> 120mm down from the top

>> ....that it will print in this exact position regardless of the printer I
am
>> using ????

>Hi,

>Use 'GetDeviceCaps' to check 'PhysicalOffsetX' and 'PhysicalOffsetY'
>These values are in pixel. With 'printer.scale' you can easily convert
>pixel -> mm

>If you then shift the printer's system of coordinates you don't even
>have to change your original program.

>  offsetxMM=7 'for example
>  offsetyMM=5 'for example
>  printer.scalemode=6 'MM
>  heightMM=printer.scaleheight
>  widthMM=printer.scalewidth

>  printer.scale ( offsetxMM,

offsetyMM),(widthMM+offsetxMM,heightMM+offsetyMM)

- Show quoted text -

Quote:

>  '.... your programm

>HTH

>Michaela



Thu, 24 May 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Absolute measurements when printing - please help..

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. can some one please help me with libs, and call absolute

4. Absolute path to access database. Please help

5. Help - Print - Help -Print - Help - Print - Help - Print - Help

6. Setting the measurement units for printing

7. Setting the measurement units for printing

8. DATAbase Printing PLEASE, PLEASE Help me - please?

9. DATAbase Printing - PLEASE, PLEASE Help me - please?

10. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

11. Printing absolute page numbers

12. HELP: Reaction time measurements with keyboard

 

 
Powered by phpBB® Forum Software