Re: Determining Available Paper Sizes on Printer
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Mar 2009 21:12:30 -0000
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message news:O31%23tWmnJHA.4540@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, Mike, that works well. and is very informative. And you're
right about looping, I looped through only the sizes given in the VB
help and online, and it worked okay, but there are a lot of other print
sizes available on many printers (including the HP LaserJet 5200 I'm
using), that you get with your routine, that wouldn't be practical with
the other method. Like 32767 for PostScript Custom Page Size. ;-)
Unfortunately, neither of these is as helpful to me as I was hoping, as
it lists all the funny sizes that we have no paper for, and which is
never loaded on a network/shared printer, so providing those options
to a normal user will just end up hanging the printer waiting for a
special paper size to be loaded.
I'm afraid printing in Windows is still not an exact science, at least as far as paper sizes or special printing arrangements is concerned. Some printers are bristling with sensors that detect the size of paper (or the presence or absence of paper) in each available tray and some are not, and even for those that are there is still no "standard" way of communicating such information to Windows. For example, I've just used Micro$oft Word 2007, which by its pedigree should know just about everything there is to know about printing in Windows, to print an A4 document to my own HP printer which was set to A5 as default and which actually contained A5 paper. The printing was carried out without any notification from either the printer or from Windows, with the result that the right hand half of each page was simply missing (the A4 output flowing over the edge of the A5 paper). Some printers behave like this and some will contain sensors that detect the actual size of paper in each tray and notify the user accordingly when he attempts to print something that does not actually fit on the page, with such notification more often than not coming from message boxes displayed by the driver rather than by Windows itself. Another thing I tried, on a printer that does properly detect an A5 page in the main tray, was to simply turn the A5 page around and insert it into the printer tray in landscape orientation. This completely "foxed" the printer because the sensor measures the paper width at the leading edge and does not in fact have any sensors to measure its "length", thereby le4ading the printer to assume that A4 was loaded in its standard portrait orientation.
In addition, for this HP 5200, it shows, both with your program, my
process of trying to set the paper size and catching errors, and even
on the printer setup itself, that it will handle C-size sheets (17" x 22"),
whereas the printer's maximum *** size is 11x17! How weird! I mean,
the width of the printers output opening is only a bit larger than 11"
Those kind of things vary from printer to printer. It may be that your own LaserJet 5200 allows you to specify a 17x22 inch paper size but that it actually prints each "page" in "multiple page poster" format, so that it in fact prints two separate 11x17 inch sheets for each 17x22 inch page in a way that enables you to "stick them together" after printing. Or in fact it could be that the printer driver you are using is a "generic for the model range" driver that can (at least in part) be used for various models in the range.
So, what I am /really/ after is what size of paper is loaded in
the printer and ready to use. I haven't found anything on that
(although if you know of something that would be great).
I'm afraid not, at least not as an unattended operation. For example many printers which are capable of printing onto special paper sizes or onto special media will have ways of detecting if any such media is actually loaded in the appropriate tray (a printer that can print directly onto printable CDs and DVDs for example) but many will not. And even on those that do the messages "insert a disk into the CD tray" (or whatever) will be displayed on the printer itself and Windows will in that case know nothing about it.
The problem is that in general a lot of money has been poured into providing standardised drivers which all obey a standard set of Windows instructions for graphics cards (DX 10 for example) because gamers spend a lot of money on machines and never stop spending extra money to keep up with the top end, and there is a lot of money in "keeping them sweet", but nothing like that amount of resources has gone into the printing side of things. Currently lots of different manufacturers produce machines with lots of different "new and better"! functions (in an attempt to keep the money rolling), most of which appeal to "the average Joe Public" rather than to businesses, but almost all of the information regarding the new or special functions is contained in a block of memory which actually does exist in Windows (in the extras section) but which only the printer driver actually understands. So the printer driver (and its associated software) can do things with the printer that Windows does not actually have any native methods for.
My compromise solution, for now, is simply to add a check
box [x] User 11" x 17" paper if available. That way, I can keep the printer set for 8 1/2" x 11" normal printing, but get
the prints using this program at 11x17 if I want them. All I
do here is when printing, save the current paper size, set the
paper size to 17 (11x17), print, then set the paper size back.
It works, but it's pretty clunky method (although easy enough
for the user).
You don't need to save the current paper size or restore it if you are setting the paper size using the Printer.Papersize method. That's because all such Printer Object settings affect only the DC which the Printer Object is currently using and they do not change the default printer settings. In fact even if you are using the dreaded CommonDialog Control and if you are allowing your user to select 11x17 paper in that it will still not affect the default printer paper settings, even if CommonDialog PrinterDefault is set to True (at least not if you are using somehting later than Win 98) because the system allows it to change the printer itself (which is regarded as a user setting) but not any of its properties.
Mike
.
- Follow-Ups:
- References:
- Determining Available Paper Sizes on Printer
- From: Rick Raisley
- Re: Determining Available Paper Sizes on Printer
- From: Mike Williams
- Re: Determining Available Paper Sizes on Printer
- From: Rick Raisley
- Determining Available Paper Sizes on Printer
- Prev by Date: Re: Problem with syntax
- Next by Date: RE: Using VBPRNDLG.DLLl Instead of Print Common Dialog Boxes
- Previous by thread: Re: Determining Available Paper Sizes on Printer
- Next by thread: Re: Determining Available Paper Sizes on Printer
- Index(es):