Home All Groups Group Topic Archive Search About
Author
7 Mar 2006 8:56 AM
Gaurav - http://www.gauravcreations.com
Is it possible to set page margins before using the form.printform option
I would like to print information on pre-printed tictkets. I was trying to
position the data on the form and then print.. but it leaves margins when
printing and spoils it

ny ideas?

--
Gaurav Creations

Author
7 Mar 2006 11:28 AM
Mike Williams
"Gaurav - http://www.gauravcreations.com" <gauravcreati***@hotmail.com>
wrote in message news:78DCE014-F3D6-4A6B-8A4D-BF82C40A12BA@microsoft.com...

> Is it possible to set page margins before using the form.printform
> option I would like to print information on pre-printed tictkets. I
> was trying to position the data on the form and then print.. but it
> leaves margins when printing and spoils it

There are various ways of printing your Form at a specific location on the
page, but if you take my advice you would forget all about dumping low
resolution screen graphics to your printer (which is effectively what
PrintForm does). Use the printer object and use its various methods (Line,
Circle, Print, etc) to print your output. That way you will be able to
position everything exactly where you want and your will also get the full
resolution of the printer, which is very high compared to the resolution of
the screen.

Mike
Author
8 Mar 2006 6:34 AM
Gaurav - http://www.gauravcreations.com
I only need to print a few numeric figures.. nothing else.. so resolution
does not matter,
anyways I will try with the printer object..

Thanks
--
Gaurav Creations


Show quoteHide quote
"Mike Williams" wrote:

> "Gaurav - http://www.gauravcreations.com" <gauravcreati***@hotmail.com>
> wrote in message news:78DCE014-F3D6-4A6B-8A4D-BF82C40A12BA@microsoft.com...
>
> > Is it possible to set page margins before using the form.printform
> > option I would like to print information on pre-printed tictkets. I
> > was trying to position the data on the form and then print.. but it
> > leaves margins when printing and spoils it
>
> There are various ways of printing your Form at a specific location on the
> page, but if you take my advice you would forget all about dumping low
> resolution screen graphics to your printer (which is effectively what
> PrintForm does). Use the printer object and use its various methods (Line,
> Circle, Print, etc) to print your output. That way you will be able to
> position everything exactly where you want and your will also get the full
> resolution of the printer, which is very high compared to the resolution of
> the screen.
>
> Mike
>
>
>
>
Author
8 Mar 2006 10:30 AM
Mike Williams
"Gaurav - http://www.gauravcreations.com" <gauravcreati***@hotmail.com>
wrote in message news:B86D44BD-346F-450A-BDC3-B46542B3356C@microsoft.com...

> I only need to print a few numeric figures.. nothing else..
> so resolution does not matter

Actually, my own opinion is that resolution of the output device matters
*most* when the output is text.

> anyways I will try with the printer object..

Good. You'll find it much better. By the way, since you're printing onto
pre-printed tickets you'll need to ensure that your stuff is positioned
accurately. This means that you'll need to take account of the fact the
"forced unprintable margins" that many printers have. The following code
will do that for you automatically and will allow you to print at precise
positions whatever printer you are using (within the physical accuracy
limits of the printer of course, which is usually quite good even on cheap
machines these days). It uses a scalemode of inches, but it will work just
as well whatever scalemode you wish to use. Also, when you're printing text
you need to be aware of the fact that the print coordinates refer to the top
left corner of the "invisible character cell" of the first character in your
text string, so you need to position your stuff accordingly.

Mike

Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nindex As Long) As Long
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113

Private Sub SetPrinterOrigin(x As Single, y As Single)
With Printer
  .ScaleLeft = .ScaleX(GetDeviceCaps(.hdc, PHYSICALOFFSETX), _
    vbPixels, .ScaleMode) - x
  .ScaleTop = .ScaleY(GetDeviceCaps(.hdc, PHYSICALOFFSETY), _
    vbPixels, .ScaleMode) - y
  .CurrentX = 0
  .CurrentY = 0
End With
End Sub

Private Sub Command1_Click()
Printer.ScaleMode = vbInches
' By default the VB printer origin "points to" the top left
' corner of the current "printable area", which is usually
' *not* the same as the top left corner of the physical page.
' You can use this code to fix this problem and to set the
' effective origin to any desired position on the physical
' page. Here we Here we use (0, 0) to set it to the exact
' top left corner:
SetPrinterOrigin 0, 0
' test by printing two very small circles at exact
' positions on the page:
Printer.FillStyle = vbFSSolid
' test by printing a small dot at location (1, 1)
Printer.Circle (1, 1), 0.015, vbBlack
Printer.EndDoc
End Sub
Author
8 Mar 2006 11:36 AM
J French
On Tue, 7 Mar 2006 22:34:26 -0800,
=?Utf-8?B?R2F1cmF2IC0gaHR0cDovL3d3dy5nYXVyYXZjcmVhdGlvbnMuY29t?=
<gauravcreati***@hotmail.com> wrote:

>I only need to print a few numeric figures.. nothing else.. so resolution
>does not matter,
>anyways I will try with the printer object..

Look up the English dictionary for 'Tyro'

Printer,CurrentX = 240
Printer,CurrentY = 30

Printer.Print "tyro"

After doing that you'll come back and we will show you how to do it
properly