FAQ
I'm wrestling with printing support for PyGUI on Windows.
I'd like to set up the coordinate system during printing
so that (0, 0) is at the corner of the paper, so that I
can arrange for the margins to have predictable sizes.

However, the device context I get from calling PrintDlg()
seems to be set up so that the origin is at the corner
of the printable area of the page, which is smaller by
some amount that depends on the printer being used.

If I could find out the limits of the printable area,
I could correct for this, but there doesn't seem to be
any straightforward way of getting this information.
It doesn't seem to appear anywhere in any of the
structs returned by PrintDlg(), and I can't find any
call that might extract it from the device context.

Am I missing something? Surely this an issue that most
applications that print have to deal with. How do they
do it?

--
Greg

Search Discussions

  • Vernon Cole at Dec 14, 2009 at 2:03 pm
    In searching for documentation, remember a quirk in Microsoft vocabulary...
    a "printer" is software, not hardware. The device on the corner of your
    desk with the paper in it is not a "printer", it is a "printing device."
    --
    Not being an expert on writing Windows printer code, nevertheless let me
    venture a guess that there may be no way to do what you want.
    My reasoning hinges on a bad experience I had in the past...
    Using Crystal Reports, a rather expensive commercial product which uses
    Windows very well, I designed a very fancy Purchase Order form, which I
    tested on three or four different Windows printers. When I installed the
    application, the purchase orders would not print out correctly on another
    printer -- the one connected to my boss's PC (of course). I had to re-design
    the report a few pixels narrower.
    --
    Please somebody tell Greg that I'm wrong.
    --
    Vernon

    On Mon, Dec 14, 2009 at 3:51 AM, Greg Ewing wrote:

    I'm wrestling with printing support for PyGUI on Windows.
    I'd like to set up the coordinate system during printing
    so that (0, 0) is at the corner of the paper, so that I
    can arrange for the margins to have predictable sizes.

    However, the device context I get from calling PrintDlg()
    seems to be set up so that the origin is at the corner
    of the printable area of the page, which is smaller by
    some amount that depends on the printer being used.

    If I could find out the limits of the printable area,
    I could correct for this, but there doesn't seem to be
    any straightforward way of getting this information.
    It doesn't seem to appear anywhere in any of the
    structs returned by PrintDlg(), and I can't find any
    call that might extract it from the device context.

    Am I missing something? Surely this an issue that most
    applications that print have to deal with. How do they
    do it?

    --
    Greg
    _______________________________________________
    Pygui mailing list
    Pygui at python.org
    http://mail.python.org/mailman/listinfo/pygui
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/pygui/attachments/20091214/78cca729/attachment.htm>
  • Greg Ewing at Dec 14, 2009 at 10:55 pm

    Vernon Cole wrote:
    In searching for documentation, remember a quirk in Microsoft
    vocabulary... a "printer" is software, not hardware. The device on the
    corner of your desk with the paper in it is not a "printer", it is a
    "printing device."
    Yes, I know. I'll be happy if I can somehow find out what
    the driver for whichever printer has been selected in the
    PrintDlg box thinks the printable area is for the selected
    paper size. If that doesn't match what the actual printer
    uses, that's not my problem. :-)

    Delving a bit further, it looks like I may be able to find
    out via GetPrinter() and GetForm()... I'll try an experiment
    shortly.
    Using Crystal Reports, a rather expensive commercial product which uses
    Windows very well, I designed a very fancy Purchase Order form, which I
    tested on three or four different Windows printers. When I installed
    the application, the purchase orders would not print out correctly on
    another printer
    Configuring printer drivers on Windows can be a massively
    confusing and frustrating experience, especially when a
    network is involved. Chance are there was a setting
    somewhere in the maze of dialog boxes that would have
    made it work properly... or maybe not...

    --
    Greg
  • Thomas Heller at Dec 14, 2009 at 8:42 pm

    Am 14.12.2009 11:51, schrieb Greg Ewing:
    I'm wrestling with printing support for PyGUI on Windows.
    I'd like to set up the coordinate system during printing
    so that (0, 0) is at the corner of the paper, so that I
    can arrange for the margins to have predictable sizes.

    However, the device context I get from calling PrintDlg()
    seems to be set up so that the origin is at the corner
    of the printable area of the page, which is smaller by
    some amount that depends on the printer being used.

    If I could find out the limits of the printable area,
    I could correct for this, but there doesn't seem to be
    any straightforward way of getting this information.
    It doesn't seem to appear anywhere in any of the
    structs returned by PrintDlg(), and I can't find any
    call that might extract it from the device context.

    Am I missing something? Surely this an issue that most
    applications that print have to deal with. How do they
    do it?
    I would guess that GetDeviceCaps() returns the information that you need.

    --
    Thanks,
    Thomas
  • Greg Ewing at Dec 15, 2009 at 11:15 am

    Thomas Heller wrote:

    I would guess that GetDeviceCaps() returns the information that you need.
    Yep, this turns out to be right, although it's *very*
    difficult to find this out if you start looking in
    the area of the docs that talks about printing!

    My margins are spot-on now. I'm happy.

    Need sleep now.

    Thanks, everyone.

    --
    Greg
  • Vernon Cole at Dec 15, 2009 at 5:52 pm
    You're the Man, Thomas!
    You, too, Greg!
    Now I have to get my latest upgrade to adodbapi done so I can put some time
    into really using pygui.
    --
    Vernon
    On Tue, Dec 15, 2009 at 4:15 AM, Greg Ewing wrote:

    Thomas Heller wrote:

    I would guess that GetDeviceCaps() returns the information that you need.
    Yep, this turns out to be right, although it's *very*
    difficult to find this out if you start looking in
    the area of the docs that talks about printing!

    My margins are spot-on now. I'm happy.

    Need sleep now.

    Thanks, everyone.

    --
    Greg
    _______________________________________________
    python-win32 mailing list
    python-win32 at python.org
    http://mail.python.org/mailman/listinfo/python-win32
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/pygui/attachments/20091215/e7c0300f/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppygui @
categoriespython
postedDec 14, '09 at 10:51a
activeDec 15, '09 at 5:52p
posts6
users3
websitecosc.canterbury.ac.nz...

People

Translate

site design / logo © 2019 Grokbase