Re: Printing

Discussion in 'Python' started by Fredrik Lundh, Dec 21, 2004.

  1. Jim & Joanne Collins wrote:

    > I've completed a semester of computer programming in Python
    > and one thing we didn't learn was how to send data to a windows
    > printer instead of the screen. I've also asked this question in one
    > of the Python help places and received about three responses.
    > None of them worked.


    since you didn't tell us what responses you've always gotten, I guess
    I have to provide more than three...

    - write directly to the printer device (PRN, LPT1)

    - write the output to a temporary file, and use the "print" command
    to send it to the printer

    out = open("temp.out", "w")
    ...
    out.close()
    os.system("print /D:LPT1 temp.out")

    - use the win32 extensions, and talk to the GDI and spooler functions (see
    Windows API documentation for details).

    - use a printer aware UI toolkit, and draw on the printer instead of the screen

    - use ReportLab or any other PDF-generating toolkit, and use Acrobat to
    print it. (same as the second alternative, but generates nicer output):

    os.system("start acrord32.exe /t /h temp.pdf printer")

    if you try any of these and it doesn't work, let us know which one, and
    what happened.

    </F>
     
    Fredrik Lundh, Dec 21, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon B
    Replies:
    7
    Views:
    7,560
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  2. JustSomeGuy
    Replies:
    13
    Views:
    519
    msalters
    Dec 9, 2004
  3. iffy agbim
    Replies:
    1
    Views:
    114
    Mark Andrews
    May 24, 2004
  4. iffy agbim
    Replies:
    0
    Views:
    113
    iffy agbim
    May 21, 2004
Loading...

Share This Page