Re: Send output to printer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jorgen Bodde

    Re: Send output to printer

    Hi,

    It depends on how your printer can be accessed. Is there a driver for
    it? The most simple way might be using ShellExecute (under windows)
    but I found no way to supress the print dialog.

    Another way is using win32com module and instantiate an IE automation
    object, which you feed a HTML page and issue a print. Be careful about
    printing too fast allow it 4-5 seconds to process or successive print
    jobs will fail.

    Here is a snippet of code to get you on your way;

    from win32com import client
    ie = client.Dispatch ("InternetExplo rer.Application ")
    ie.Navigate(fn) # fn = filename (to temp file) to print
    time.sleep(2)
    ie.ExecWB(6, 2)
    time.sleep(2)
    ie.Quit()
    ie = None

    For successive prints it is better to instantiate one IE object per
    multiple print jobs, but once done, release it and set it up again.

    - Jorgen






    On Wed, Jun 25, 2008 at 6:54 AM, ajak_yahoo <arazak73@yahoo .com.mywrote:
    Need some help from you all,
    >
    I already manage to write a program to print a packaging label.
    >
    The output on screen is as below,
    >
    >
    Part Number : PWEE1111AA
    Quantity : 100 pcs
    Lot Number : 10A2008
    Customer : ABC Pte. Ltd.
    >
    >
    My questions is how can I send this output to my Panasonic KX-P1121 dot
    matric printer,
    Is it a module that i can used, previously i wrote my program using foxpro
    2.6, i have no experience in python.
    >
    >
    Regards,
    Ajak
    --

    >
Working...