Problems with Printer.Font Object 
Author Message
 Problems with Printer.Font Object

Hello All,

I get some strange behaviour from VB5 compiler when I try using some
very simple statements as:

Printer.FontName = "Arial"
Printer.FontSize = 9

Sometimes these statements are accepted, sometimes simply ignored.

I tried also with Font object:

Printer.Font.Name = "Arial"
Printer.Font.Size = 9

And I tried all possible combinations (setting size before name,
repeating size after name, ...)

Has anybody already get similar troubles?

Thanks & Regards in Advance
pp



Sat, 23 Mar 2002 03:00:00 GMT  
 Problems with Printer.Font Object
Yes. It has been a problem with the VB printer object since the earliest
versions. I think (but I am not sure) that downloading and installing
Service Pack 3 will fix it in VB 5. However, even without installing the
Service Pack you can fix it yourself quite easily by "toggling" the
properties that you are having trouble with. For example, if you are having
some problems with the FontName then just use:

Printer.FontName = "Times New Roman"  any valid name will do here
Printer.Print
Printer.FontName= "Arial"

. . . . . and

Printer FontSize = 999 ' any value that you do NOT want
Printer.Print
Printer.Fontsize = 9

You will also often find similar problems with other Printer Object stuff
(FontTransparent, for example, is a common one). These can all be cured in
the same way. For example, if you want fonts to be printed transparenetly
and are having a little trouble with it then you can use:

Printer.FontTransparent = False
Printer.Print
Printer.FontTransparent = True

The "Printer.Print" statement in between the two settings is important. It
will not work if you leave it out. If this bothers you, then you can simply
save the current settings of CurrentX and CurrentY before you do any of this
stuff and then restore them afterwards.

Also, you may also find that the VB printer object forgets what it is
suppoosed to be doing after a NewPage statement! Wierd, I know - but that's
what sometimes happens - and we have to live in the real world. I have got
into the habit of toggling all my parameters (they can't touch you for it!)
at the very start of the print job and also after each NewPage statement -
and my print-outs are always exactly as expected.

I have thought long and hard about why VB should behave like this - and I
think that I have discovered the answer - but I am a little bit drunk at the
moment (one and a half bottles of the famous "Opal Ridge" Shiraz Cabernet
(1998) 12.5% Vol is to blame for that!) - so I will leave it for the moment
(the explanation, that is - not the Shiraz!)

Mike


Quote:
> Hello All,

> I get some strange behaviour from VB5 compiler when I try using some
> very simple statements as:

> Printer.FontName = "Arial"
> Printer.FontSize = 9

> Sometimes these statements are accepted, sometimes simply ignored.

> I tried also with Font object:

> Printer.Font.Name = "Arial"
> Printer.Font.Size = 9

> And I tried all possible combinations (setting size before name,
> repeating size after name, ...)

> Has anybody already get similar troubles?

> Thanks & Regards in Advance
> pp



Sat, 23 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printer.Font.Name and Printer.Font.Size problems with HP LaserJets

2. Printer Object - Font problem

3. Font Clipping To Printer Object Problems

4. Font Clipping To Printer Object Problems

5. Printer object and printer fonts

6. A HOW-TO: Setting Printer fonts: WAS Printer fonts

7. font transparent on printer object doesn't work

8. Using Fonts with the Printer object

9. printer object and available fonts

10. REQ: Font isn't transparant on Printer object in VB 5.0

11. printer object.Impossible to use fonts!

12. Why printer object won't stay reset to correct font/size

 

 
Powered by phpBB® Forum Software