RE: Print to Windows default Printer

Discussion in 'Python' started by Tim Golden, Jan 20, 2005.

  1. Tim Golden

    Tim Golden Guest

    [Samantha]
    | Thanks Tim. I didn't realize it would be so difficult.
    | S

    Strictly, if all you want to do is print text and you
    have mapped LPTx: to some printer (local or network)
    then the venerable "PRINT <filename>" or "COPY <filename> LPTx:"
    may well be what you want. You can issue these via
    an os.system call from within Python, and if that serves
    the purpose, well...

    <code>

    import os

    f = open ("temp.txt", "w")
    f.write ("""I must go down to the sea again,
    To the lonely sea and the sky.
    And all I ask is a tall ship
    And a star to steer her by.
    """)
    f.close ()

    os.system ("print temp.txt")

    </code>

    TJG

    ________________________________________________________________________
    This e-mail has been scanned for all viruses by Star. The
    service is powered by MessageLabs. For more information on a proactive
    anti-virus service working around the clock, around the globe, visit:
    http://www.star.net.uk
    ________________________________________________________________________
    Tim Golden, Jan 20, 2005
    #1
    1. Advertising

  2. Tim Golden

    Samantha Guest

    Thanks Tim,
    That is exactly what I want to do.
    How do I map the printer to LPT1?
    S
    "Tim Golden" <> wrote in message
    news:...
    > [Samantha]
    > | Thanks Tim. I didn't realize it would be so difficult.
    > | S
    >
    > Strictly, if all you want to do is print text and you
    > have mapped LPTx: to some printer (local or network)
    > then the venerable "PRINT <filename>" or "COPY <filename> LPTx:"
    > may well be what you want. You can issue these via
    > an os.system call from within Python, and if that serves
    > the purpose, well...
    >
    > <code>
    >
    > import os
    >
    > f = open ("temp.txt", "w")
    > f.write ("""I must go down to the sea again,
    > To the lonely sea and the sky.
    > And all I ask is a tall ship
    > And a star to steer her by.
    > """)
    > f.close ()
    >
    > os.system ("print temp.txt")
    >
    > </code>
    >
    > TJG
    >
    > ________________________________________________________________________
    > This e-mail has been scanned for all viruses by Star. The
    > service is powered by MessageLabs. For more information on a proactive
    > anti-virus service working around the clock, around the globe, visit:
    > http://www.star.net.uk
    > ________________________________________________________________________
    Samantha, Jan 20, 2005
    #2
    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. KK
    Replies:
    0
    Views:
    378
  2. Samantha

    Print to Windows default Printer

    Samantha, Jan 18, 2005, in forum: Python
    Replies:
    2
    Views:
    316
    Samantha
    Jan 18, 2005
  3. Tim Golden

    RE: Print to Windows default Printer

    Tim Golden, Jan 19, 2005, in forum: Python
    Replies:
    3
    Views:
    349
    Samantha
    Jan 20, 2005
  4. Tim Golden

    RE: Print to Windows default Printer

    Tim Golden, Jan 20, 2005, in forum: Python
    Replies:
    1
    Views:
    318
    Samantha
    Jan 20, 2005
  5. Tim Golden

    RE: Print to Windows default Printer

    Tim Golden, Jan 20, 2005, in forum: Python
    Replies:
    1
    Views:
    319
    Peter Hansen
    Jan 20, 2005
Loading...

Share This Page