Announcement

Collapse
No announcement yet.

Printer envelope sizes supported

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printer envelope sizes supported

    I have been writing a program which prints envelope addresses. I can use the
    printer dialog box while the program is running to determine which envelope sizes
    are supported on my HP Laserjet 4L. And once I know them, I can use the DEVMODE
    structure to call out a supported envelope size. But can anyone tell me how I
    can code an enumeration of the supported sizes for any printer?

    For example, my HP 4L supports less than half of those that are available. Other
    printers might not support that many. I need to know which ones are supported
    for any selected printer. I'm sure there is a way to do it, and I hope someone
    out there has some ideas. I will appreciate any help offered.

  • #2
    The way to do this is to use DeviceCapabilities() with the
    %DC_PAPERS flag.

    This should return a "list" of paper sizes but one thing I remember from the various books/articles I've read may not be good news for you:
    Many printer drivers incorrectly report the paper sizes that they support - some return numbers that have no representation in the list of "known" paper sizes (see the equates in WIN32API.INC, or report wrong sizes altogether. The problem also is known to occur with the list of trays (paper-sources) reported by some drivers. The biggest issue is that these effects vary between drivers and platforms - some report much more accurately than others!

    All of these details are covered in "Win32 Programming" (Rector/Newcomer) and "Print Programming in Windows (Jeff Potts). The Potts book is not value for money in my humble opinion, but it should help you with this problem. For my money, I'd look at the Rector/Newcomer book as it covers this stuff and a whole lot more besides.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thank you, Lance. DeviceCapabilities() was exactly what I was looking for.
      And I will keep your warnings of its shortcomings in mind.

      I have been on the verge of buying Rector/Newcomer for some time, but it
      is a very expensive book and I haven't been able to find a discount, not
      even from Amazon.com. Your recommendation of the book may just inspire me
      to bite the bullet. Thanks again, Lance.


      ------------------

      Comment

      Working...
      X