|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Form.PrintformIs 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 "Gaurav - http://www.gauravcreations.com" <gauravcreati***@hotmail.com> There are various ways of printing your Form at a specific location on the 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 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 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 -- Show quoteHide quoteGaurav Creations "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 > > > > "Gaurav - http://www.gauravcreations.com" <gauravcreati***@hotmail.com> Actually, my own opinion is that resolution of the output device matters 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 *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 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 Look up the English dictionary for 'Tyro'>does not matter, >anyways I will try with the printer object.. 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
MS, Enough is Enough!
Can someone please check my code? No Intellisense for items About The Hard Disk Serial Number Crazy VB Convert Variant String to Double Acces Denied when calling FaxDocument Submit Creating an ActiveX control WHERE clause in ADO query of Excel data Lock Word window? Launch VB App with Arguments via Hyperlink |
|||||||||||||||||||||||