Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
How to determine printer type?
Old
  (#1)
Meyer1228
Guest
 
Posts: n/a
Default How to determine printer type? - 06-04-2007, 08:51 AM

We're printing invoices using the printer function in VB6. If we print to
an IBM-compatible dot-matrix, we can use a font called "12 CPI HSD" which
works well, since we want to use 12-pitch. If we want to print to our HP
Laser, we need to know that it is a laser so we can change the font to
something comparable. Is there a way to determine what type of printer is
selected - i.e. Laser(or deskjet) or Dot Matrix?


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: How to determine printer type?
Old
  (#2)
Raoul Watson
Guest
 
Posts: n/a
Default Re: How to determine printer type? - 06-04-2007, 08:51 AM


"Meyer1228" <EMAIL REMOVED> wrote in message
news:PsJwb.2704$EMAIL REMOVED...
> We're printing invoices using the printer function in VB6. If we print to
> an IBM-compatible dot-matrix, we can use a font called "12 CPI HSD" which
> works well, since we want to use 12-pitch. If we want to print to our HP
> Laser, we need to know that it is a laser so we can change the font to
> something comparable. Is there a way to determine what type of printer is
> selected - i.e. Laser(or deskjet) or Dot Matrix?
>


There are winAPI's for printer properties but I don't believe you can
directly draw a "device type or device ID" since all printers suppose to be
treated just like any drawing area.

I can't think of how I would do it. If it is a controlled environment for
example (i.e you're only dealing with a finite printer devices), I probably
would get the printer name and just compare it to the supported list.

One thing I would try probably is set the resolution to beyond what the
device can handle. For example, ***uming I have an HP 700 deskjet, when I do
this:

' attempt to set 1200 dpi
Printer.PrintQuality = 1200
x = Printer.PrintQuality
if x < 1200 then ' it failed to set 1200 dpi

Another way is to probably set the printer font directly to what you know
don't exist on the printer:

Printer.Font = "Courier"
x = Printer.FontName
if x <> "Courier" then 'printer can't do Courier substituted X

They are all kludgy was of determining the printer type but given several
known variables and behavior of printers (to include Colormode) you probably
can make a decent decision based on those variables.


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top