Printing file with printer dialog

Discussion in 'Python' started by Marco Bonifazi, Oct 25, 2006.

  1. Hello!

    I have a file (in my situation it is a Postscript file or a Pdf file,
    but it isn't important).

    I must send this file to a printer, using Python, and I need to select
    the printer to which I want send this file.
    Then I would use a Dialog Window.

    I use PyGtk on Windows (but if I can open a dialog without PyGtk is
    also good), I would know all methods to do it.

    Thanks also if you don't answer!

    Marco Bonifazi

    http://www.bonifazi.eu
     
    Marco Bonifazi, Oct 25, 2006
    #1
    1. Advertising

  2. On 25 Oct 2006 09:32:06 -0700, "Marco Bonifazi"
    <> declaimed the following in comp.lang.python:

    > Hello!
    >
    > I have a file (in my situation it is a Postscript file or a Pdf file,
    > but it isn't important).
    >

    Au contraire (pardon the slaughtered French)

    On Windows, most files need to be printed by an application that can
    render the file contents as bitmap pages. You might be able to send a
    raw Postscript file to a Postscript aware printer, but unless the
    printer also understands PDF syntax, you will probably have to invoke
    Acrobat Reader to print it -- or some other program that can read and
    render PDF.

    >>> import subprocess
    >>> x = subprocess.Popen([r"c:\Program Files\Adobe\Acrobat 7.0\Reader\acrord32.exe",

    .... "/p", "aprs101.pdf"])
    >>>


    Is sufficient (on my machine) to have Acrobat Reader's print dialog
    appear -- though one must then physically select the printer (if the
    default is not desired) and activate the actual "print". It also has the
    drawback of leaving a minimized Reader in the task bar.

    > I must send this file to a printer, using Python, and I need to select
    > the printer to which I want send this file.
    > Then I would use a Dialog Window.
    >
    > I use PyGtk on Windows (but if I can open a dialog without PyGtk is
    > also good), I would know all methods to do it.
    >


    In general though, I suspect you'll need to study the win32print
    module in the Windows extensions -- and by the time you've gone that
    far, you might find some way to activate the win32 common dialogs
    without needing PyGtk.

    >>> import win32print
    >>> for p in win32print.EnumPrinters(win32print.PRINTER_ENUM_LOCAL, None, 1):

    .... print p
    ....
    (8388608, 'ScanSoft PDF Create!,ScanSoft PDF Create!,', 'ScanSoft PDF
    Create!', '')
    (8388608, 'Procomm Plus 32 Fax,Procomm Plus Fax Driver,', 'Procomm Plus
    32 Fax', '')
    (8388608, 'Intuit Internal Printer,Amyuni PDF Converter 2.07,Virtual',
    'Intuit Internal Printer', 'Print to File!')
    (8388608, 'hp deskjet 6122 series,hp deskjet 6122 series,', 'hp deskjet
    6122 series', '')
    (8388608, 'Fax,Microsoft Shared Fax Driver,', 'Fax', '')
    (8388608, 'ESP 960 Color Managed,EPSON Stylus Photo 960,', 'ESP 960
    Color Managed', '')
    (8388608, 'EPSON Stylus Photo 960,EPSON Stylus Photo 960,Back of Rack',
    'EPSON Stylus Photo 960', 'Look at all the pretty pictures')
    >>>

    --
    Wulfraed Dennis Lee Bieber KD6MOG

    HTTP://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
     
    Dennis Lee Bieber, Oct 25, 2006
    #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. Samuel Lee
    Replies:
    0
    Views:
    549
    Samuel Lee
    Nov 11, 2003
  2. Jody Burgess
    Replies:
    2
    Views:
    555
    George Kinney
    Jul 17, 2004
  3. Askari
    Replies:
    3
    Views:
    503
    Steve Holden
    Oct 16, 2004
  4. Raymond
    Replies:
    0
    Views:
    207
    Raymond
    Oct 22, 2008
  5. Replies:
    5
    Views:
    170
Loading...

Share This Page